Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not natural legend order for stacked bar chart #4161

Closed
jan-tosovsky-cz opened this issue Apr 20, 2017 · 5 comments · Fixed by #7851
Closed

Not natural legend order for stacked bar chart #4161

jan-tosovsky-cz opened this issue Apr 20, 2017 · 5 comments · Fixed by #7851

Comments

@jan-tosovsky-cz
Copy link

If following conditions are met:

  • chart type is 'bar' (vertical)
  • y-axis is stacked
  • legend position is either left or right

then the default legend order doesn't correspond with the order of stacked parts:
https://jsfiddle.net/yjp7LxgL/1/

It makes reading chart data harder.

@simonbrunel
Copy link
Member

Using the legend.reverse option should help:

    legend: {
        position: 'right',
        reverse: true
    }

@etimberg we could also add a legend.labels.sorter option to give more control on the item order?

@etimberg
Copy link
Member

@simonbrunel good idea on the sort function. I'm happy to look at a PR from someone implementing this.

@etimberg etimberg added this to the Version 2.7 milestone May 21, 2017
@simonbrunel simonbrunel modified the milestone: Version 2.7 Sep 10, 2017
@ericnkatz
Copy link
Contributor

So I have a similar complaint tied to the tooltips here:

screen shot 2017-10-18 at 3 40 26 pm

Seems like the default behavior for drawing stacked graphs bottom -> up should be altered or updated.

Maybe have stacked: true be stacked: 'normal' or stacked: 'reverse'

@mkstix6
Copy link

mkstix6 commented Jun 28, 2019

Maybe have stacked: true be stacked: 'normal' or stacked: 'reverse'

That sounds great.
Although I just came here looking for a way to sort a doughnut chart's wedges by descending order whilst displaying the legend in alphabetical order. If it's not possible now the ability to implement a custom sort function for either/both might be more flexible?

@kiran-plivo
Copy link

Maybe have stacked: true be stacked: 'normal' or stacked: 'reverse'

this seems to be not working, any other way to resolve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants