When I built a chart setting the property IsDateTime = true in below code, the chart it does't show:
"
List<double> line1 = new List<double>();
List<double> line2 = new List<double>();
List<double> line3 = new List<double>();
List<double> line4 = new List<double>();
List<double> line5 = new List<double>();
List<double> line6 = new List<double>();
List<double> line7 = new List<double>();
DateTime startDate = new DateTime(2010,1,1);
DateTime endDate = new DateTime(2010,1,15);
string xml = e.Result;
using (XmlReader reader = XmlReader.Create(new System.IO.StringReader(xml)))
{
reader.ReadToDescendant("data");
if (reader.Depth > 0) {
do {
// All attribute data are double values
// this.loop adds 7 items into each collection
line1.Add(double.Parse(reader.GetAttribute("data1")));
line2.Add(double.Parse(reader.GetAttribute("data2")));
line3.Add(double.Parse(reader.GetAttribute("data3")));
line4.Add(double.Parse(reader.GetAttribute("data4")));
line5.Add(double.Parse(reader.GetAttribute("data5")));
line6.Add(double.Parse(reader.GetAttribute("data6")));
line7.Add(double.Parse(reader.GetAttribute("data7")));
}while (reader.ReadToNextSibling("data"));
}
}
this._chart.DefaultView.ChartArea.AxisX.AutoRange = false;
this._chart.DefaultView.ChartArea.AxisX.IsDateTime = true;
this._chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd/MM/yyyy";
this._chart.DefaultView.ChartArea.AxisX.LabelRotationAngle = -45;
this._chart.DefaultView.ChartArea.AxisX.MinValue = startDate.ToOADate();
this._chart.DefaultView.ChartArea.AxisX.MaxValue = endDate.ToOADate();
this._chart.DefaultView.ChartArea.AxisX.Step = startDate.AddDays(1).ToOADate() - startDate.ToOADate();
this.AddSeriesMapping("Series 1", 0);
this.AddSeriesMapping("Series 2", 1);
this.AddSeriesMapping("Series 3", 2);
this.AddSeriesMapping("Series 4", 3);
this.AddSeriesMapping("Series 5", 4);
this.AddSeriesMapping("Series 6", 5);
this.AddSeriesMapping("Series 7", 6);
List<double[]> itemsSource = new List<double[]>();
itemsSource.Add(line1.ToArray());
itemsSource.Add(line2.ToArray());
itemsSource.Add(line3.ToArray());
itemsSource.Add(line4.ToArray());
itemsSource.Add(line5.ToArray());
itemsSource.Add(line6.ToArray());
itemsSource.Add(line7.ToArray());
this._chart.ItemsSource = itemsSource;
this._chart.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollAndZoom;
this._chart.DefaultView.ChartArea.ZoomScrollSettingsY.ScrollMode = ScrollMode.ScrollAndZoom;
this._chart.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible;
this._chart.DefaultView.ChartArea.AxisY.MinorGridLinesVisibility = Visibility.Visible;
this._chart.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible;
this._chart.DefaultView.ChartLegend.Margin = new Thickness(15, 0, 0, 0);
"
My question is: This is a bug?
Thanks.