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

[Solved] DateTimeCategoricalAxis tick only for months and not for each day

4 Answers 108 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrea
Top achievements
Rank 1
Andrea asked on 22 Mar 2014, 11:13 AM
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?

4 Answers, 1 is accepted

Sort by
0
Accepted
Ivaylo Gergov
Telerik team
answered on 24 Mar 2014, 05:03 PM
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:
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.
0
Accepted
Ivaylo Gergov
Telerik team
answered on 25 Mar 2014, 03:34 PM
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
 

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.
Tags
Chart for XAML
Asked by
Andrea
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Andrea
Top achievements
Rank 1
Share this question
or