Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/traces/sunburst/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ exports.calc = function(gd, trace) {
if(failed) return;

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

var pullColor;
var scaleColor;
Expand Down
10 changes: 10 additions & 0 deletions src/traces/sunburst/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,15 @@ module.exports = {
'Colors provided in the trace, using `marker.colors`, are never',
'extended.'
].join(' ')
},
sort: {
valType: 'boolean',
dflt: true,
role: 'style',
editType: 'calc',
description: [
'sort on values.',
'default true'
].join(' ')
}
};
1 change: 1 addition & 0 deletions src/traces/sunburst/layout_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {
}
coerce('sunburstcolorway', layoutOut.colorway);
coerce('extendsunburstcolors');
coerce('sort');
};