We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Order the bar chart by it's value

Hi, i have a list of object contains "Item name" and "Quantity". When i bind that object to a bar chart, the chart is ordered by Item name.
Even though i've ordered the list by quantity, it still ordered by item name on the chart. What should i do if i want the chart is ordered by quantity ?

I'm using syncfusion essential studio by the way.

Thank you ! :)

3 Replies

DD Dharanidharan Dharmasivam Syncfusion Team August 22, 2017 12:21 PM UTC

Hi Caraka, 

Thanks for contacting Syncfusion support. 

We have analyzed your query. Your requirement can be achieved by using SortBy property of series. In this enum property you can specify either X or Y with respect to which you need to sort the points. This is applicable only if you render the x axis as category, since if you render in double it will render linearly and will not able to sort it. Find the code snippet below to achieve this requirement. 
Windows Forms: 

series1.SortBy = ChartSeriesSortingType.Y; 
series1.Points.Add("Server 1", 256); 
series1.Points.Add("Server 2", 351); 
series1.Points.Add("Server 3", 210); 
series1.Points.Add("Server 4", 200); 
series1.Points.Add("Server 5", 240); 

Screenshot for sorting with respect to Y: 

Sorting with respect to X: 
Sample for reference can be find from below link.


CW Caraka Wedhatama August 25, 2017 08:56 AM UTC

Hi Dharanidharan Dharmasivam,

That solved my case. Thank's a lot :)

PN Preethi Nesakkan Gnanadurai Syncfusion Team August 25, 2017 11:40 AM UTC

Hi Caraka,  
Most Welcome. 
Please let us know if you need any further assistance. 

Live Chat Icon For mobile
Up arrow icon