Date series on the X-Axis of a Column chart is not displayed as expected

3 posts, 0 answers
  1. Vibhor
    Vibhor avatar
    6 posts
    Member since:
    Mar 2012

    Posted 25 Jun 2018 Link to this post

         Here is the output of my SQL procedure 

    10/2/2017 12:00:00 AM
    10/9/2017 12:00:00 AM
    10/16/2017 12:00:00 AM
    10/23/2017 12:00:00 AM

    But the x-axis on the chart displays the following 

    10/1/2017
    10/8/2017
    10/15/2017
    10/22/2017

    It displays the previous date instead of the  date passed from the procedure.

    Attached screen shots of the graph. 

    Can some please help with this??

    Thanks Vibhor.

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4931 posts

    Posted 27 Jun 2018 Link to this post

    Hello,

    When a date axis is used, the chart aggregates the data as best as it can for a certain period whose beginning is shown on the x-axis. You can control that period through the BaseUnit property of the XAxis:

    So, depending on your data and requirements, perhaps setting it to Days will suit your needs.

    The alternative I can offer is that you prepare string representation of the dates in the data source and use them as simple categories instead of using a date axis. The benefit is that this gives you precise control over what will be shown (you can format labels as you see fit, you will have 1:1 parity between the data source rows and the rendered data points). The downside is that all items will be spaced evenly as the chart will no longer consider them dates and space them out accordingly. This means that a trend may get distorted or you may have to fill in missing data (days).


    Regards,
    Marin Bratanov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Vibhor
    Vibhor avatar
    6 posts
    Member since:
    Mar 2012

    Posted 28 Jun 2018 in reply to Marin Bratanov Link to this post

    Thanks Marin,

    The BaseUnit property didn't work out for me as expected, I tried using string in place of dates and it works fine for now. I'll will work out the missing data part.

    Thanks again.

    Vibhor

Back to Top