Autoscaling dates ???

Thread is closed for posting
4 posts, 0 answers
  1. Pete
    Pete avatar
    31 posts
    Member since:
    May 2008

    Posted 16 May 2008 Link to this post

    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.

  2. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 17 May 2008 Link to this post

    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
  3. Pete
    Pete avatar
    31 posts
    Member since:
    May 2008

    Posted 26 Jun 2008 Link to this post

    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.
  4. Pete
    Pete avatar
    31 posts
    Member since:
    May 2008

    Posted 01 Jul 2008 Link to this post

    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.
Back to Top