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

XAxis with fix label distance

2 Answers 73 Views
Chart
This is a migrated thread and some comments may be shown as answers.
ManniAT
Top achievements
Rank 2
ManniAT asked on 04 Sep 2009, 12:05 PM
Hi,

I have a simple (I guessed) problem.
I use a linechart which displays datapoints with a DateTime for the XAxis.
It has between 20 and 100 datapoints. (the point distance is between 0.1 and 0.8 seconds).

All I want are labels on the XAxis which show every second a tick and an alternate view which shows all 2 seconds a tick.

I guess I do something completely wrong :)
To find the value I display the label in the format "ss.f"
I messed around with the two seconds an reached now at this point:
rcData.DefaultView.ChartArea.AxisX.Step = 0.000022890946517388024;
But still I have some "drift" - this means I get:
17.3, 19.4, 21.5...and it ends in 37.9, 40.0 instead of 39...

Since I can't imagine that it is that difficult to have a XAxis with labels for one second or 2 seconds it stop playing around and ask for a solution here; because I think what I try it totally wrong.

So the simple question:
a.) how to have a XAxis with labels every second
b.) how to have a XAxis with labels every 2 seconds

Regards

Manfred

2 Answers, 1 is accepted

Sort by
0
Accepted
Dwight
Telerik team
answered on 09 Sep 2009, 01:41 PM
Hi Manfred,

To get the right step, use:
double oneSecond = 1.0d / (24 * 60 * 60);
rcData.DefaultView.ChartArea.AxisX.Step = oneSecond;

Best,
Evtim
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
ManniAT
Top achievements
Rank 2
answered on 09 Sep 2009, 09:09 PM
Thank you for this :)

Great Telerik support as usual!

Manfred
Tags
Chart
Asked by
ManniAT
Top achievements
Rank 2
Answers by
Dwight
Telerik team
ManniAT
Top achievements
Rank 2
Share this question
or