I am creating a chart to display real-time data that is "polled" every 5 seconds. Additionally, my chart can contain multiple data series all of which will be spline. If I let the chart auto calculate the X axis bounds and ticks, it is extremely slow in displaying initial values. So I want to set the X axis manually. Here is the code I have so far:
|radChart1.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Normal;|
|radChart1.DefaultView.ChartArea.AxisX.IsDateTime = true;|
|radChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "T";|
|radChart1.DefaultView.ChartArea.AxisX.AutoRange = false;|
|DateTime MinVal = DateTime.Now;|
|DateTime MaxVal = MinVal + TimeSpan.FromSeconds(UpdateInterval * (NumDataPoints + 1));|
|radChart1.DefaultView.ChartArea.AxisX.AddRange(MinVal.ToOADate(), MaxVal.ToOADate(), 1.0);|
|radChart1.DefaultView.ChartArea.AxisX.Step = 0.05;|
|radChart1.DefaultView.ChartArea.AxisX.LabelStep = 1;|
Note that the default value for UpdateInterval is 5 and NumDataPoints is 10
However, using the above code, I only get two ticks on the X axis. What I really want is that the number of ticks should be the same as NumDataPoints and they should be equally distributed between the Min and Max of the X axis range. How can I achieve that? I have tried playing around with Step and LabelStep values but did not get anything different.
Any help would be greatly appreciated.