Adding 1 Month Intervals to Chart X-Axis Range

3 posts, 0 answers
  1. Luis Rizo
    Luis Rizo avatar
    12 posts
    Member since:
    Jul 2009

    Posted 26 Oct 2009 Link to this post

    Hello all,

    I'm trying to chart some data and I'm having trouble getting the points to plot in the correct order with AutoRange, so I'm trying to set the X Axis Range myself.

    I'm using a Date value as the X Data Points, and I've almost got it working correctly, except I can't get the Step size correct. I want the step to be 1 Month, but unfortunately there doesn't seem to be a way to set a "month" as a step interval for the XAxis.Step property.

    If I try to set the step to 31 days, I get the behavior shown in the 31DaysStep screenshot (see attached). Basically I get months shown redundantly. If I try to do 32 day steps to overcomes this, the opposite behavior occurrs and the extra days between months start to add up quick, so that my labels don't line up with my dates (See 32DayStep screenshot).

    Any idea what I can do in this situation? AutoRange is not an option because when I map multiple series, sometimes the 2nd or 3rd series will have datapoints that are in-between those of the 1st series and as a result the point will be plotted in the incorrect X-Value label.

    Thanks for your help.
  2. Luis Rizo
    Luis Rizo avatar
    12 posts
    Member since:
    Jul 2009

    Posted 27 Oct 2009 Link to this post

    Hello again,

    I tried creating a DataPointCollection based on my values and adding that to the XAxis property, but while this plots the X-Axis Labels correctly, my series does not plot on the chart. It's odd because the Y-Values will adjust based on what data I choose to plot, but it's almost as if the X-Value of the series I'm adding never matches the X-Values of the X-Axis DataPointCollection.

    Are there any examples out there of charting by setting the X-Axis DataPointCollection? I looked but couldn't find anything.
  3. Dwight
    Dwight avatar
    475 posts

    Posted 29 Oct 2009 Link to this post

    Hello Luis,

    It is not possible to set a correct Step, since each month has different number of days in it.
    What I suggest is set numeric for X (1, 2, 3, etc.) and then go through the AxisX collection and set custom label for each TickPoint of the axis.

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