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

Sorting doesn't work when dealing with dates

1 Answer 65 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Arthur
Top achievements
Rank 1
Veteran
Iron
Arthur asked on 09 Nov 2020, 12:23 PM

I've had this issue for two years (StackOverflow post), and today I checked if the latest version of kendo fixed this issue and it looks like it didn't.

Sorting a chart against a string field works fine, as demonstrated in the following string dojo.

But when I try and sort it against a date field it simply doesn't do anything, as demonstrated in this date dojo.

 

Is there something I'm missing?

1 Answer, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 11 Nov 2020, 11:09 AM

Hi, Arthur,

Thank you for the provided examples and screenshots.

The reason for this behaviour is that the category axis is a date axis and it automatically aggregates and plots the data:

https://docs.telerik.com/kendo-ui/controls/charts/elements/date-series#date-series-in-categorical-charts

If you want to keep using a date axis, you can use the categoryAxis.reverse property or set the chart categoryAxis type to "category" which cease to aggregate and behave as a date chart and will plot all of the available points so you will need to add a label format as well just like the string example you have provided:

Here is an updated Dojo for your reference that pictures both of these options:

https://dojo.telerik.com/@bubblemaster/ebuYUTEL

Let us know in case of further questions.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Charts
Asked by
Arthur
Top achievements
Rank 1
Veteran
Iron
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or