Skip to content

Commit 8ccebbb

Browse files
sunburst & treemap root color attribute
1 parent dadcd06 commit 8ccebbb

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

src/traces/sunburst/attributes.js

+13
Original file line numberDiff line numberDiff line change
@@ -215,5 +215,18 @@ module.exports = {
215215
},
216216
sort: pieAttrs.sort,
217217

218+
root: {
219+
color: {
220+
valType: 'color',
221+
editType: 'style',
222+
role: 'style',
223+
dflt: null, // rgba(0,0,0,0),
224+
description: [
225+
'sets the color of the root node for a sunburst or a treemap trace.'
226+
].join(' ')
227+
},
228+
editType: 'plot'
229+
},
230+
218231
domain: domainAttrs({name: 'sunburst', trace: true, editType: 'calc'})
219232
};

src/traces/sunburst/calc.js

+3
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ exports._runCrossTraceCalc = function(desiredType, gd) {
278278
} else {
279279
// root gets no coloring by default
280280
cdi.color = 'rgba(0,0,0,0)';
281+
if (cdi.trace.root) {
282+
cdi.color = cdi.trace.root.color;
283+
}
281284
}
282285
}
283286
}

src/traces/sunburst/defaults.js

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

7878
coerce('rotation');
7979

80+
coerce('root.color');
81+
8082
handleDomainDefaults(traceOut, layout, coerce);
8183

8284
// do not support transforms for now

src/traces/treemap/attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ module.exports = {
269269
].join(' ')
270270
},
271271
sort: pieAttrs.sort,
272+
root: sunburstAttrs.root,
272273

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

src/traces/treemap/defaults.js

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

117117
coerce('sort');
118118

119+
coerce('root.color');
120+
119121
handleDomainDefaults(traceOut, layout, coerce);
120122

121123
// do not support transforms for now

0 commit comments

Comments
 (0)