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

Binding the X-axis to a DateTime

2 Answers 24 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Schley
Top achievements
Rank 1
Schley asked on 14 Feb 2012, 10:22 PM
Am I mistaken in understanding that the RadChart control cannot recognize beyond the Day component of a DateTime with regards to specificity. I plotted five values and they all appeared along the origin. Their X-values were different by seconds.

2 Answers, 1 is accepted

Sort by
0
Schley
Top achievements
Rank 1
answered on 15 Feb 2012, 12:54 AM
I discovered my mistake and have it working. However, what if the Min and Max values are separated by 60 seconds. How do I indicate that the step should represent 5 second intervals so that the appropriate tick marks are created?
0
Evgenia
Telerik team
answered on 17 Feb 2012, 04:09 PM
Hi Schley,

You may review our SL demo (the approach is absolutetely the same for WPF) where we specified a Step of 1 sec to the XAxis - http://demos.telerik.com/silverlight/#Chart/LiveData

private void SetUpAxisXRange(DateTime now)
        {
            this.AxisXMinValue = now.AddSeconds(-14.5).ToOADate();
            this.AxisXMaxValue = now.ToOADate();
            this.AxisXStep = 1.0 / 24.0 / 3600.0 / 2.0;
        }

You can easily customize the Step using the formula, but note that you should have the AutoRange property of the XAxis to false to have your modifications applied.

All the best,
Evgenia
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Chart
Asked by
Schley
Top achievements
Rank 1
Answers by
Schley
Top achievements
Rank 1
Evgenia
Telerik team
Share this question
or