Hello Guys,
i wanna create a chart with custom x-axis range and interval, but it doesn´t work :(
I had a look at your online documentation and i have written this code:
ChartArea analogArea = new ChartArea();
chart1.Areas.Add(analogArea);
ChartSeries analogSeries = new ChartSeries(ChartTypes.Spline);
chart1.Areas[0].Series.Add(analogSeries);
chart1.Areas[0].PrimaryAxis.LabelRotateAngle = 270;
chart1.Areas[0].PrimaryAxis.IsAutoSetRange = false;
chart1.Areas[0].PrimaryAxis.ValueType = ChartValueType.DateTime;
chart1.Areas[0].PrimaryAxis.DateTimeRange = new DateTimeRange(new DateTime(2012, 1, 1, 12, 0, 0), new DateTime(2012, 1, 1, 13, 30, 0));
chart1.Areas[0].PrimaryAxis.MinimumDateTimeInterval = new TimeSpan(00, 15, 00);
chart1.Areas[0].PrimaryAxis.DateTimeInterval = new TimeSpan(00, 15, 00);
ChartListData points = new ChartListData();
points.ChartXValueType = ChartValueType.DateTime;
points.AddPoint(new DateTime(2012, 01, 01, 12, 00, 00), 1);
points.AddPoint(new DateTime(2012, 01, 01, 12, 30, 00), 0);
points.AddPoint(new DateTime(2012, 01, 01, 13, 00, 00), 1);
points.AddPoint(new DateTime(2012, 01, 01, 13, 30, 00), 0);
analogSeries.Data = points;
When I did not bind the data to the chart, the chart will be shown correctly!
Why does ist not work? Please help me!
best regards
Fabian Tholl