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

Autoscaling dates ???

3 Answers 111 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Pete
Top achievements
Rank 1
Pete asked on 16 May 2008, 10:32 AM
Hi, can you tell me if it is possible to autoscale the dates, so if I had 20 values to plot at various dates, it can scale the x-axis in 7 day scales, ie Sunday 6th, Sunday 13th, Sunday 20th, Sunday 27th etc, and then plots the values in between these, each date is not that important as I can use the tooltip to show the actual value. The problem I have is because telerik can't bind dates to the grid I have converted the dates to strings and displayed them with the 

RadChart1.PlotArea.XAxis[i].TextBlock.Text = dateTime.ToShortDateString();

But if I get 2 dates the same it plots them next to each other. If I change the autoscale to True it substitutes the dates with incremented numbers (ie 1....20).

Thanks,

Pete Walker.

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 17 May 2008, 08:09 AM
Hi Pete,

You can use LabelStep property to set X axis to display only certain labels. In addition -- to add dates to an axis or chart item, values must be converted to OleAutomation date.  Use the DateTime ToOADate() method for this purpose. I have attached a sample, which shows this functionality.

Hope this helps.

Greetings,
Ves
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Pete
Top achievements
Rank 1
answered on 26 Jun 2008, 12:25 PM
Hi, sorry for the late reply. The sample you attached is fine for dates in a incremental order, but what if the dates are random and you could have more than one result on the same day, then a 2 week gap before the next one?

Is there any way that you can have the xaxis labels just for every 7 days, and the values random displaying as normal. When I tried your sample although the xaxis labels were fine, the plotted results were all pushed into one side of the graph and the hover values did not match what the dates on the labels were on the xaxis.

Thanks a lot.
0
Pete
Top achievements
Rank 1
answered on 01 Jul 2008, 09:47 AM
Hi, this now works fine when you convert the datetime to datetime.toOadate, as long as you put a minvalue and maxvalue for the minimum and maximum dates you want plotted against the graph it will spread it across the graph as required.

Cheers,

Pete.
Tags
Chart (Obsolete)
Asked by
Pete
Top achievements
Rank 1
Answers by
Ves
Telerik team
Pete
Top achievements
Rank 1
Share this question
or