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

Turn Off CategoryAxis Sorting In Column / Bar / Line Charts

2 Answers 64 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 17 Aug 2015, 06:09 PM

Hello Telerik Community,

 I have a column chart that is displaying data sorted alphabetically, and I would like to turn this off so that it displays the data based on the order of the array that I put in for the categories. I'm using Javascript for my charting needs and I have a dataset that is returning grouped data based on Month, and the month names are being sorted alphabetically as you can see in the screenshot below. I would like them to sort based on their order in the array which is already ordered properly based on months.

 Any thoughts?

 Thanks!

2 Answers, 1 is accepted

Sort by
0
Joshua
Top achievements
Rank 1
answered on 17 Aug 2015, 06:44 PM

I should add that my setup code looks like the following:

 $scope.reports[i].DataSource = {                        
                        series: $scope.reports[i].Series,
                        seriesDefaults: {
                            type: $scope.reports[i].ChartTypeSystemName
                        },
                        sort: false,
                        categoryAxis: {
                            categories: $scope.reports[i].CategoriesDisplay,
                            majorGridLines: {
                                visible: false
                            },
                            labels: {
                                rotation: "auto"
                            }
                        },
                        legend: {
                            position: "top"
                        },
                        theme: 'Fiori',
                        tooltip: {
                            visible: true,
                            template: "#= category # - #= series.name #: #= value #"
                        }
                    }; 

You'll notice that I'm manually bringing in my Series and Categories and the arrays that contain these are already in the correct orientation and should not be sorted, so basically I just want the chart to take what I give it, and display it in the same order.

0
Iliana Nikolova
Telerik team
answered on 19 Aug 2015, 08:52 AM
Hi Joshua,

I am not quite sure what causes the illustrated outcome. Could you please provide a dojo which demonstrates your exact dataSource / series / categories configuration - this way I would be able to provide concrete recommendations and advise you further? Thank you in advance for your cooperation and time.

Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Charts
Asked by
Joshua
Top achievements
Rank 1
Answers by
Joshua
Top achievements
Rank 1
Iliana Nikolova
Telerik team
Share this question
or