This is a migrated thread and some comments may be shown as answers.

Problem configuring X axis manually

3 Answers 41 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Ambar Kulkarni
Top achievements
Rank 1
Ambar Kulkarni asked on 17 May 2010, 09:18 PM

Hello Everyone,

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.

Thanks

-Ambar

3 Answers, 1 is accepted

Sort by
0
Ambar Kulkarni
Top achievements
Rank 1
answered on 19 May 2010, 12:50 PM
Anybody has any ideas? Come on Telerik geniuses - this one should be easy for you.
0
Accepted
Vladimir Milev
Telerik team
answered on 20 May 2010, 08:52 AM
Hello Ambar Kulkarni,

Have you taken a look at our example here? It shows how such scenario can be accomplished. It should be no more difficult to do it if you are using a manual range X Axis.

Sincerely yours,
Vladimir Milev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ambar Kulkarni
Top achievements
Rank 1
answered on 20 May 2010, 07:59 PM
Thanks, thats exactly what I needed.
-Ambar
Tags
Chart
Asked by
Ambar Kulkarni
Top achievements
Rank 1
Answers by
Ambar Kulkarni
Top achievements
Rank 1
Vladimir Milev
Telerik team
Share this question
or