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

Months on X-Axis for line series

2 Answers 84 Views
Chart
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 16 Nov 2010, 09:25 AM
Hi,
I'm trying to customize the X-Axis to look as attached. That means I have several area charts (which represent borders) and one dataserie with only one point (which is the current measure).

The measure is done all along the year and I would like to know if it is possible to have on axis X one major tick per month ? As I have seen on this forum, this is not possible...

For the moment, I use the following code, but there is always two ticks per month...
ChartArea.AxisX.AddRange(new DateTime(year, 1, 1).ToOADate(), new  DateTime</span>(year, 12, 31).ToOADate(), 16);
Thanks for your reply! David

2 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 18 Nov 2010, 05:18 PM
Hello David,

Indeed, the X axis is linear and it accepts double values. When working with DateTime values they are again converted to doubles. However, each month contains different number of days, which makes it hard to define a step, which could ensure that every 1-st day of the month is shown.

Please, find attached a small example. It shows how this scenario can be implemented by manually controlling the axis labels appearance. The X axis is configured with step 1, so there is a label for every day. Then, looping through the axis items, only the ones for 15-th day of each month stays visible, while others are hidden. This makes the labels appear in the middle of the month and not in its beginning, so a data point for 28-th Jan would still appear closer to Jan rather than Feb. Hope this is applicable.

Regards,
Ves
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
David
Top achievements
Rank 1
answered on 19 Nov 2010, 10:47 AM
Hello,
Thank you very much. This is exactly what I need. I don't think anyone will see the difference with February..

Have a nice day
David
Tags
Chart
Asked by
David
Top achievements
Rank 1
Answers by
Ves
Telerik team
David
Top achievements
Rank 1
Share this question
or