0

in my windows phone universal app i am trying to add scatter series on y axis. i am dynamically adding series on chart and then setting scale with the Minimum,Maximum, and Interval. In some of the cases when interval become greater then 10 chart scale not appearing as desired. please help. thanks in advance.

DateTimeAxis x = new DateTimeAxis() { Orientation = AxisOrientation.X, Location =     AxisLocation.Bottom };
        string InterValType = "";
        int interval = 0;

         CalulateInterValForDateAxis(DictVarData.ElementAt(DictVarData.Count - 1).Name, DictVarData.ElementAt(0).Name, ref InterValType, ref interval);

        x.Interval = interval;
        x.IntervalType = InterValType == "Days" ? DateTimeIntervalType.Days : InterValType == "Months" ? DateTimeIntervalType.Months : DateTimeIntervalType.Years;

        Style st = new Style(typeof(DateTimeAxisLabel));
        st.Setters.Add(new Setter(DateTimeAxisLabel.StringFormatProperty, "{0:MM/dd/yy}"));
        st.Setters.Add(new Setter(DateTimeAxisLabel.FontSizeProperty, "10"));
        st.Setters.Add(new Setter(DateTimeAxisLabel.ForegroundProperty, "Black"));

        x.AxisLabelStyle = st;



        Style stmin = new Style(typeof(Line));
        stmin.Setters.Add(new Setter(Line.HeightProperty, "10"));
        stmin.Setters.Add(new Setter(Line.StrokeProperty, "Black"));
        stmin.Setters.Add(new Setter(Line.StrokeThicknessProperty, "2"));
        stmin.Setters.Add(new Setter(Line.X1Property, "0"));
        stmin.Setters.Add(new Setter(Line.X2Property, "10"));
        stmin.Setters.Add(new Setter(Line.Y1Property, "0"));
        stmin.Setters.Add(new Setter(Line.Y2Property, "10"));
        x.MajorTickMarkStyle = stmin;


      LinearAxis y = new LinearAxis() { Orientation = AxisOrientation.Y, Location = AxisLocation.Left, Minimum = YMinValue, Maximum = YMaxValue,Interval=YInterval };
      y.FontSize = 10;
      y.ShowGridLines = true;
      y.Margin = new Thickness(0);
      y.Foreground = new SolidColorBrush(Colors.Black);

      this.ScatterChart.Axes.Add(y);

      ScatterSeries ScatterS = new ScatterSeries();

      for (int cntY = 0; cntY < General.VariableArrayYAxis.Count; cntY++)
      {
          if (cntY != 0)
              ScatterS = new ScatterSeries();

          ScatterS.DependentValuePath = "Value";
          ScatterS.IndependentValuePath = "Name";
          ScatterS.Name = General.VariableArrayYAxis[cntY].ToString();
          ScatterS.DataPointStyle = (Style)App.Current.Resources[GetStyleName(dictColorUsedForVariable[General.VariableArrayYAxis[cntY]])];
          this.ScatterChart.Series.Add(ScatterS);
      }



        this.ScatterChart.Axes.Add(x);

        this.ScatterChart.Background = new SolidColorBrush(Colors.White);

       ScatterS.DependentRangeAxis = this.ScatterChart.ActualAxes[0] as DateTimeAxis;
       ScatterS.DependentRangeAxis = this.ScatterChart.ActualAxes[1] as LinearAxis;
SUNIL JOSHI
  • 192
  • 1
  • 12

1 Answers1

0

in my case i am providing custom range for the axis by setting minimum and maximum value and interval for the range. in winrt-xaml-toolkit it adjusting the scale by its own and which is creating problem for me. so i ll change the source code and make it auto for custom scale and interval.

SUNIL JOSHI
  • 192
  • 1
  • 12