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

sunburst & treemap root color attribute #5232

Merged
merged 4 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
13 changes: 13 additions & 0 deletions src/traces/sunburst/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,18 @@ module.exports = {
},
sort: pieAttrs.sort,

root: {
archmoj marked this conversation as resolved.
Show resolved Hide resolved
archmoj marked this conversation as resolved.
Show resolved Hide resolved
color: {
valType: 'color',
editType: 'style',
thierryVergult marked this conversation as resolved.
Show resolved Hide resolved
role: 'style',
dflt: null, // rgba(0,0,0,0),
description: [
'sets the color of the root node for a sunburst or a treemap trace.'
thierryVergult marked this conversation as resolved.
Show resolved Hide resolved
].join(' ')
},
editType: 'plot'
thierryVergult marked this conversation as resolved.
Show resolved Hide resolved
},

domain: domainAttrs({name: 'sunburst', trace: true, editType: 'calc'})
};
3 changes: 3 additions & 0 deletions src/traces/sunburst/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ exports._runCrossTraceCalc = function(desiredType, gd) {
} else {
// root gets no coloring by default
cdi.color = 'rgba(0,0,0,0)';
if(cdi.trace.root) {
cdi.color = cdi.trace.root.color;
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/traces/sunburst/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout

coerce('rotation');

coerce('root.color');

handleDomainDefaults(traceOut, layout, coerce);

// do not support transforms for now
Expand Down
1 change: 1 addition & 0 deletions src/traces/treemap/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ module.exports = {
].join(' ')
},
sort: pieAttrs.sort,
root: sunburstAttrs.root,

domain: domainAttrs({name: 'treemap', trace: true, editType: 'calc'}),
};
2 changes: 2 additions & 0 deletions src/traces/treemap/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout

coerce('sort');

coerce('root.color');

handleDomainDefaults(traceOut, layout, coerce);

// do not support transforms for now
Expand Down