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

re-order X-Axis

3 Answers 79 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Li
Top achievements
Rank 1
Li asked on 10 Dec 2010, 08:50 PM
Hi,

I have a MVVM application that dynamic generating Charts base on database queries. There is case that we have seriesA(2005, 2006, 2007), seriesB(2005,2006, ...) and seriesC(1999,2000, 2001...2005,2006), since the chart series were set from A to C, the x-axis displayed out of order like '2005, 2006, 2007, 1999, 2000.

Is there a property that can set the chart to start from the earliest year(date) on x-axis ?

Thanks,

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 13 Dec 2010, 09:18 AM
Hello Li,

In this case, if the default behavior of the chart does not meet your requirements well, you can turn off the autosclaling of the XAxis, set the min and max values, as well as the step. This would allow more flexibility in this setup.
I hope that this is a feasible approach for you.

All the best,
Yavor
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Li
Top achievements
Rank 1
answered on 20 Dec 2010, 08:33 PM
Thanks for your respones. I'm still having problem with having AutoRange=false, how should I set up the step, min, and max, labelStep?

1) if I have the below setting, I still got out of ordered AxisX  and lost the Y value;

DefaultLabelFormat =

 

"yyyy";
IsDateTime=true; AutoRange=false;
MinValue= new DateTime(1995, 1, 1).ToOADate();
MaxValue=new DateTime(DateTime.Today.Year, 12, 31).ToOADate();
Step=365;

2) Another dataset, I need to display as monthly,  
DefaultLabelFormat = "MM/dd/yyyy";
Step=30;

Thanks.

0
Evgeni "Zammy" Petrov
Telerik team
answered on 23 Dec 2010, 09:17 AM
Hello Li,

 To get your data sorted on the X axis you should order your data by the value that you map on X axis.
The snipped  you have pasted seems to be correct, I do not see anything wrong with it.

As alternative solution, I would like to point you to this example: http://demos.telerik.com/silverlight/#Chart/DateTimeGrouping. This way you will not need to configure the X axis. Just provide the correct group descriptors and let RadChart do the rest. (The WPF example is similar)

Regards,
Evgeni "Zammy" Petrov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
Chart
Asked by
Li
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Li
Top achievements
Rank 1
Evgeni "Zammy" Petrov
Telerik team
Share this question
or