Jump to content
Software FX Community

Mick

Members
  • Posts

    78
  • Joined

  • Last visited

Everything posted by Mick

  1. When I create a stacked area chart and I try to set the Y Axis max value, it appears to lose the data for any / all of the SeriesAttributes in the chart. Here is a quick mock up of the offending code, The single line that makes the difference is in red (second to last line of code): class DataPoint { public DateTime Date { get; set; } public double Price { get; set; } } public Chart GetChart() { Chart chart = new Chart(); chart.Gallery = Gallery.Area; chart.AxisX.Labels.Format = AxisFormat.Date; IList<DataPoint> points0 = new List<DataPoint>(); points0.Add(new DataPoint { Date = DateTime.Parse("1/1/2008"), Price = 1 }); points0.Add(new DataPoint { Date = DateTime.Parse("2/1/2008"), Price = 4 }); points0.Add(new DataPoint { Date = DateTime.Parse("3/1/2008"), Price = 2 }); SeriesAttributes series0 = new SeriesAttributes(); series0.Gallery = Gallery.Area; series0.Stacked = true; series0.ItemsSource = points0; series0.BindingPathX = "Date"; IList<DataPoint> points1 = new List<DataPoint>(); points1.Add(new DataPoint { Date = DateTime.Parse("1/1/2008"), Price = 1 }); points1.Add(new DataPoint { Date = DateTime.Parse("2/1/2008"), Price = 2 }); points1.Add(new DataPoint { Date = DateTime.Parse("3/1/2008"), Price = 1 }); SeriesAttributes series1 = new SeriesAttributes(); series1.Gallery = Gallery.Area; series1.Stacked = true; series1.ItemsSource = points1; series1.BindingPathX = "Date"; chart.Series.Add(series0); chart.Series.Add(series1); // This causes the chart to lose track of the data it contains when uncommented chart.AxisX.Max = 10; return chart; }I stripped down this example to be as simple as possible, but perhaps I'm overlooking something. I need to be able to set the Y axis because it appears that the chart's algorithm attempts to do this automatically by selecting the max value of only one of the SeriesAttributes, rather than the max combined value of all SeriesAttributes (and data is cut off). Thank you, Mick
×
×
  • Create New...