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

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

2 Answers 186 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vibhor
Top achievements
Rank 1
Vibhor asked on 25 Jun 2018, 08:42 AM

     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 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 27 Jun 2018, 10:30 AM
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.
0
Vibhor
Top achievements
Rank 1
answered on 28 Jun 2018, 05:42 AM

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

Tags
General Discussions
Asked by
Vibhor
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Vibhor
Top achievements
Rank 1
Share this question
or