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

Disable automatic sorting of the slices in the sunburst #4823

Closed
xanderwallace85 opened this issue Apr 8, 2020 · 7 comments
Closed

Disable automatic sorting of the slices in the sunburst #4823

xanderwallace85 opened this issue Apr 8, 2020 · 7 comments
Labels
feature something new

Comments

@xanderwallace85
Copy link

Hi guys!

Would it be possible to add an option that disables the automatic sorting of the slices in the sunburst?
Thank you in advance!

@emmanuelle emmanuelle transferred this issue from plotly/plotly.py May 10, 2020
@emmanuelle
Copy link
Contributor

This was also asked for on the forum https://community.plotly.com/t/order-of-the-sectors-in-sunburst-plot/39182.

Also see #4728 which is related.

@archmoj archmoj added the feature something new label May 11, 2020
@thierryVergult
Copy link
Contributor

+1 for this request so that plotly sunburst does not sort (apply magic) on the data provided.

I'm new to the plotly code base, but will try to find the code where sorting happens.

@thierryVergult
Copy link
Contributor

In ./traces/sunburst/calc.js, sorting happens at

// TODO add way to sort by height also?
hierarchy.sort(function(a, b) { return b.value - a.value; });

Making that line conditional was solving my use case (no sorting).

Will try to add a configuration option, in line with branchvalues, to make this configurable.

@thierryVergult
Copy link
Contributor

Is there a preference for a name of the layout attribute to disable sorting on values? One option is to reuse +sort+, an attribute available for the pie chart. Another option is to make it sunburst specific, like sunburstnosort.

@archmoj
Copy link
Contributor

archmoj commented Sep 23, 2020

Is there a preference for a name of the layout attribute to disable sorting on values? One option is to reuse +sort+, an attribute available for the pie chart. Another option is to make it sunburst specific, like sunburstnosort.

I think you could simply reuse sort for that.

sort: extendFlat({}, pieAttrs.sort, {
  dflt: true
})

@archmoj
Copy link
Contributor

archmoj commented Sep 23, 2020

Please note the dflt for sunburst (and treemap) should be set to true as their default.

@archmoj
Copy link
Contributor

archmoj commented Sep 28, 2020

Resolved by #5164.

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

No branches or pull requests

4 participants