echarts icon indicating copy to clipboard operation
echarts copied to clipboard

Is it possible to sort the bars by ascending or descending order in a bar chart?

Open pauturvalles opened this issue 7 years ago • 6 comments

It is a very basic question, how can I sort the bars on a bar chart?

In my particular case, I want the bars to be sorted by ascending order, that is, I want the shortest bar to be on the left side of the chart and the tallest bar on the right side. I thought it would be a basic option, but I've searched the documentation I didn't find anything.

Thanks in advance!

pauturvalles avatar Dec 12 '18 10:12 pauturvalles

@pauturvalles Simply sort the array of data before you hand it off to Echarts.

jonavila avatar Dec 12 '18 13:12 jonavila

@pauturvalles Simply sort the array of data before you hand it off to Echarts.

Oh, I thought echarts would have some kind of sorting function, but I'll do as you say. Thanks!

pauturvalles avatar Dec 13 '18 07:12 pauturvalles

Is there any way to sort the bars when they are stacked?

irmie-rod-kobai avatar Apr 21 '22 22:04 irmie-rod-kobai

I know this issue is old but I try my luck here anyway: I am looking for a way to implement dynamic sorting of the dataset on behalf of the user. This could be some sort of toolbox button, which allows you to toggle between ascending and descending sorting order. A similar behaviour is e.g. supported by most table controls. Are there any plans to implement this in ECharts?

fschmenger avatar Mar 07 '23 16:03 fschmenger

Is there any way to sort the bars when they are stacked?

Hey @irmie-rod-kobai were you able to resolve this? I also have the exact use-case.

theBstar avatar Mar 09 '23 02:03 theBstar

I think this feature needs to be implemented somewhere around here

qoomon avatar Sep 12 '23 12:09 qoomon