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

Adding 1 Month Intervals to Chart X-Axis Range

2 Answers 210 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Luis Rizo
Top achievements
Rank 1
Luis Rizo asked on 26 Oct 2009, 09:31 PM
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 Answers, 1 is accepted

Sort by
0
Luis Rizo
Top achievements
Rank 1
answered on 27 Oct 2009, 02:53 PM
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.
0
Dwight
Telerik team
answered on 29 Oct 2009, 01:16 PM
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,
Evtim
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.
Tags
Chart
Asked by
Luis Rizo
Top achievements
Rank 1
Answers by
Luis Rizo
Top achievements
Rank 1
Dwight
Telerik team
Share this question
or