Skip to content

Commit aad34f1

Browse files
authored
Merge pull request #5232 from thierryVergult/treemapDrilldown
sunburst & treemap root color attribute
2 parents 0d79ea9 + 2f07963 commit aad34f1

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

src/traces/sunburst/attributes.js

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

218+
root: {
219+
color: {
220+
valType: 'color',
221+
editType: 'calc',
222+
role: 'style',
223+
dflt: 'rgba(0,0,0,0)',
224+
description: [
225+
'sets the color of the root node for a sunburst or a treemap trace.',
226+
'this has no effect when a colorscale is used to set the markers.'
227+
].join(' ')
228+
},
229+
editType: 'calc'
230+
},
231+
218232
domain: domainAttrs({name: 'sunburst', trace: true, editType: 'calc'})
219233
};

src/traces/sunburst/calc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ exports._runCrossTraceCalc = function(desiredType, gd) {
276276
dfltColorCount++;
277277
}
278278
} else {
279-
// root gets no coloring by default
280-
cdi.color = 'rgba(0,0,0,0)';
279+
// set root color. no coloring by default.
280+
cdi.color = cdi.trace.root.color;
281281
}
282282
}
283283
}

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)