DateTimeCategoricalAxis Monthly Major Ticks

4 posts, 0 answers
  1. jantoine
    jantoine avatar
    7 posts
    Member since:
    Jul 2012

    Posted 05 Sep 2012 Link to this post

    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.
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 10 Sep 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. jantoine
    jantoine avatar
    7 posts
    Member since:
    Jul 2012

    Posted 10 Sep 2012 Link to this post

    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.
  5. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 11 Sep 2012 Link to this post

    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.

Back to Top