This question is locked. New answers and comments are not allowed.
Hi,
I'm trying to build a chart where I have a bar series with 365 points, each for one day of the year.
I'm using a DateTimeCategoricalAxis and I would like to show a tick only for each month and not for each day and show the month label between the ticks.
How can I do this?
I'm trying to build a chart where I have a bar series with 365 points, each for one day of the year.
I'm using a DateTimeCategoricalAxis and I would like to show a tick only for each month and not for each day and show the month label between the ticks.
How can I do this?
4 Answers, 1 is accepted
0
Accepted
Hello,
For such scenario I suggest that you use DateTimeContinuousAxis instead of DateTimeCategoricalAxis. Then you can set the DateTimeContinuousAxis.MajorStepUnit to Month and the DateTimeContinuousAxis.MajorStep to 1. Thus, you will have one label for each month. Initially the label shows the whole date but you can format it through the DateTimeContinuousAxis.LabelFormat property. For example, if you want to show only the name of the month the code should look like this:
I hope this helps.
Regards,
Ivaylo Gergov
Telerik
For such scenario I suggest that you use DateTimeContinuousAxis instead of DateTimeCategoricalAxis. Then you can set the DateTimeContinuousAxis.MajorStepUnit to Month and the DateTimeContinuousAxis.MajorStep to 1. Thus, you will have one label for each month. Initially the label shows the whole date but you can format it through the DateTimeContinuousAxis.LabelFormat property. For example, if you want to show only the name of the month the code should look like this:
Chart:DateTimeContinuousAxis MajorStep="1" MajorStepUnit="Month" LabelFormat="{}{0:MMMM}" />I hope this helps.
Regards,
Ivaylo Gergov
Telerik
Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.
0
Andrea
Top achievements
Rank 1
answered on 25 Mar 2014, 04:37 AM
Hello,
I tried your solution and it works. The only problem I have is that bars are continuous while I would like to have an horizontal space between each bar, like in DateTimeCategoricalAxis.
The only way I found is to set MajorStepUnit="Day" but doing this I have labels for each day and not for each month.
I tried your solution and it works. The only problem I have is that bars are continuous while I would like to have an horizontal space between each bar, like in DateTimeCategoricalAxis.
The only way I found is to set MajorStepUnit="Day" but doing this I have labels for each day and not for each month.
0
Accepted
Hello,
If you set the DateTimeContinuousAxis.PlotStretch ​property to Uniform there will be space between each bar.
Let me know if this works for you.
Regards,
Ivaylo Gergov
Telerik
If you set the DateTimeContinuousAxis.PlotStretch ​property to Uniform there will be space between each bar.
Let me know if this works for you.
Regards,
Ivaylo Gergov
Telerik
Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.
0
Andrea
Top achievements
Rank 1
answered on 26 Mar 2014, 04:25 AM
Hello,
it works!
Thank you very much.
it works!
Thank you very much.