DateTime x-axis / Format as week of year

2 posts, 0 answers
  1. James
    James avatar
    20 posts
    Member since:
    Nov 2017

    Posted 07 Jan 2019 Link to this post

    I have a Telerik.Reporting.Graph configured as a Line graph with a DateTime x-axis. Is there a way I can format the graph label so that it displays the week of the date? For example, instead of displaying a date and time, I'd like the x-axis label to display "Week 1 - 2018", "Week 2 - 2018", etc.

    The formatting seems declarative without any ability to introduce customization that transforms the graph label.

    I attached a screenshot for reference.



  2. Todor
    Todor avatar
    520 posts

    Posted 10 Jan 2019 Link to this post

    Hello Jim,

    To customize the X-axis label you may use CategoryScale instead of DateTimeScale. Note that DateTime object properties like DayOfYear, etc. are Integer and *not* DateTime and are not suitable for DateTimeScale.
    In the CategoryScale you may set CategoryGroups->Groupings to the desired Expression - check the attached screenshot and report definition.
    For the particular requirement to use the Week of the Year it may be necessary to create a User function that returns the desired string based on the corresponding data field, as DateTime does not have a dedicated property for this value.

    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top