Skip to content

Commit d191ac4

Browse files
authored
Merge pull request #5164 from thierryVergult/sunburstSort
Make sunburst and treemap sort optional
2 parents 35474a1 + a66b42d commit d191ac4

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

src/traces/sunburst/attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ module.exports = {
203203
'this option won\'t have any effect and `insidetextfont` would be used.'
204204
].join(' ')
205205
}),
206+
sort: pieAttrs.sort,
206207

207208
domain: domainAttrs({name: 'sunburst', trace: true, editType: 'calc'})
208209
};

src/traces/sunburst/calc.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ exports.calc = function(gd, trace) {
192192
if(failed) return;
193193

194194
// TODO add way to sort by height also?
195-
hierarchy.sort(function(a, b) { return b.value - a.value; });
195+
if(trace.sort) {
196+
hierarchy.sort(function(a, b) { return b.value - a.value; });
197+
}
196198

197199
var pullColor;
198200
var scaleColor;

src/traces/sunburst/defaults.js

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
7373

7474
coerce('insidetextorientation');
7575

76+
coerce('sort');
77+
7678
handleDomainDefaults(traceOut, layout, coerce);
7779

7880
// do not support transforms for now

src/traces/treemap/attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ module.exports = {
268268
'Sets the positions of the `text` elements.'
269269
].join(' ')
270270
},
271+
sort: pieAttrs.sort,
271272

272273
domain: domainAttrs({name: 'treemap', trace: true, editType: 'calc'}),
273274
};

src/traces/treemap/defaults.js

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
114114
coerce('pathbar.edgeshape');
115115
}
116116

117+
coerce('sort');
118+
117119
handleDomainDefaults(traceOut, layout, coerce);
118120

119121
// do not support transforms for now

0 commit comments

Comments
 (0)