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

DateTimeCategoricalAxis Monthly Major Ticks

3 Answers 123 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
jantoine
Top achievements
Rank 1
jantoine asked on 05 Sep 2012, 02:00 PM
Hello,

I am trying to create a stack bar chart. The value of the bars series data is a number and the category is the date of every Sunday of a particular date range. So basically the data is per week. However I would like the horizontal axis to only show the month and year of the data. So again basically only having a tick every 4-5 bars (because some months have 4 Sundays while other may have 5). How would I go about accomplishing this?

Thanks,

Jon.

3 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 10 Sep 2012, 08:03 AM
Hello Jon,

I think that the way to go here is to use a GenericDataPointBinding for the CategoryBinding, which should return a DateTime with the item's year and month (all other values such as day, hour, minute should be the same for each item). This will force the bars to be placed in the proper year-month category, which will result in what you have described. I have attached a simple project to this post and a snapshot of the result. Let us know if this is what you are after.   

Greetings,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
jantoine
Top achievements
Rank 1
answered on 10 Sep 2012, 12:56 PM
Thanks for replying.

However this solution does not work when the CombineMode property is set to Stack. So I really don't see any difference from this solution and a normal RadCartesianChart implementation that sets the DateTimeCategoricalAxis DateTimeComponent property to Month.

So in your solution I would need some kind of hybrid combine mode Cluster the data of the same series but Stack the data from the different series.  I have the data in the form I want, all I want to do is only show one month year label every 4 to 5 bars.

This does seem like a perplexing issue.

Thanks again.
0
Petar Marchev
Telerik team
answered on 11 Sep 2012, 07:57 AM
Hello Jantoine,

It seems that you need a feature that is not present in the chart view - two-level-grouping. Once you need to group the items by year-month-day, then group them by year-month. This is currently not present in this control.

I can suggest that you add the series through code behind and handle the stacks manually. I have attached a demo project to demonstrate this approach and a snapshot of the output it produces. Here I create a new series for each bar and set its proper stack group key and category. Usually I would not suggest such an approach (adding many series with a single item in a series) but I think this is the only way to achieve the scenario in mind.      

All the best,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ChartView
Asked by
jantoine
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
jantoine
Top achievements
Rank 1
Share this question
or