-
Couldn't load subscription status.
- Fork 0
adding layout.colorway #2
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
2bd8e75
4bba9fb
0a5b3a3
7c7a5a7
6de8f2e
36665db
a4b828f
9219ee9
caeb21d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,5 +175,6 @@ module.exports = { | |
| role: 'info', | ||
| editType: 'legend', | ||
| description: 'Determines whether or not a legend is drawn.' | ||
| } | ||
| }, | ||
| colorway: colorAttrs.defaults, | ||
|
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -454,6 +454,9 @@ plots.supplyDefaults = function(gd) { | |
|
|
||
| newFullLayout._initialAutoSizeIsDone = true; | ||
|
|
||
| // pass along trace colors | ||
| newFullLayout._colorway = newLayout.colorway; | ||
|
||
|
|
||
| // keep track of how many traces are inputted | ||
| newFullLayout._dataLength = newData.length; | ||
|
|
||
|
|
@@ -950,8 +953,9 @@ plots.supplyFrameDefaults = function(frameIn) { | |
| }; | ||
|
|
||
| plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInIndex) { | ||
| var colorway = layout._colorway || Color.defaults; | ||
| var traceOut = {}, | ||
| defaultColor = Color.defaults[traceOutIndex % Color.defaults.length]; | ||
| defaultColor = colorway[traceOutIndex % colorway.length]; | ||
|
|
||
| function coerce(attr, dflt) { | ||
| return Lib.coerce(traceIn, traceOut, plots.attributes, attr, dflt); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "data": [ | ||
| {"y": [8, 7, 7, 6, 5, 4, 4, 3, 2, 2, 3]}, | ||
| {"y": [7, 7, 6, 5, 4, 4, 3, 2, 2, 3, 8]}, | ||
| {"y": [7, 6, 5, 4, 4, 3, 2, 2, 3, 8, 7]}, | ||
| {"y": [6, 5, 4, 4, 3, 2, 2, 3, 8, 7, 7]}, | ||
| {"y": [5, 4, 4, 3, 2, 2, 3, 8, 7, 7, 6]}, | ||
| { | ||
| "labels": ["a","b","c","c","c","a","d","e"], | ||
| "type": "pie", | ||
| "domain": {"x": [0, 0.4]}, | ||
| "xaxis": "x2", | ||
| "yaxis": "y2" | ||
| } | ||
| ], | ||
| "layout": { | ||
| "title": "Custom Trace Color Defaults", | ||
| "colorway": [ | ||
| "#DE5845", | ||
| "#E83898", | ||
| "#A83DD1", | ||
| "#5A38E8", | ||
| "#3C71DE" | ||
| ], | ||
| "xaxis": { | ||
| "domain": [0.4, 1] | ||
| }, | ||
| "yaxis": { | ||
| "anchor": "y2" | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cleanDatais intended for legacy code only, so maybe we don't have to propagatecolorwayhere.