Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2k
Color gradient for scatter3d snail trail lines [WIP]#617
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
4549f4f64344a2c51d7191ae19327347847File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1590,7 +1590,9 @@ Plotly.restyle = function restyle(gd, astr, val, traces) { | ||
| 'outsidetextfont.size', 'outsidetextfont.family', 'outsidetextfont.color', | ||
| 'hole', 'scalegroup', 'domain', 'domain.x', 'domain.y', | ||
| 'domain.x[0]', 'domain.x[1]', 'domain.y[0]', 'domain.y[1]', | ||
| 'tilt', 'tiltaxis', 'depth', 'direction', 'rotation', 'pull' | ||
| 'tilt', 'tiltaxis', 'depth', 'direction', 'rotation', 'pull', | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @etpinard just thinking about how these arrays could simply be done by flags in the
It's possible to first cover 1, 2 and maybe 3 but even that leaves quite a lot of entanglement. | ||
| 'line.showscale', 'line.cauto', 'line.autocolorscale', 'line.reversescale', | ||
| 'marker.line.showscale', 'marker.line.cauto', 'marker.line.autocolorscale', 'marker.line.reversescale' | ||
| ]; | ||
| for(i = 0; i < traces.length; i++) { | ||
| if(Plots.traceIs(gd._fullData[traces[i]], 'box')) { | ||
| @@ -1612,6 +1614,8 @@ Plotly.restyle = function restyle(gd, astr, val, traces) { | ||
| var replotAttrs = [ | ||
| 'zmin', 'zmax', 'zauto', | ||
| 'marker.cmin', 'marker.cmax', 'marker.cauto', | ||
| 'line.cmin', 'line.cmax', | ||
| 'marker.line.cmin', 'marker.line.cmax', | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha. Good 👀 . Thanks. This is good enough for now until #648 is addressed. | ||
| 'contours.start', 'contours.end', 'contours.size', | ||
| 'contours.showlines', | ||
| 'line', 'line.smoothing', 'line.shape', | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -17,16 +17,21 @@ var subTypes = require('./subtypes'); | ||
| // common to 'scatter', 'scatter3d' and 'scattergeo' | ||
| module.exports = function calcMarkerColorscale(trace) { | ||
| if(!subTypes.hasMarkers(trace)) return; | ||
| var marker = trace.marker; | ||
| // auto-z and autocolorscale if applicable | ||
| if(hasColorscale(trace, 'marker')) { | ||
| calcColorscale(trace, marker.color, 'marker', 'c'); | ||
| if(subTypes.hasLines(trace) && hasColorscale(trace, 'line')) { | ||
| calcColorscale(trace, trace.line.color, 'line', 'c'); | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nicely done here. | ||
| } | ||
| if(hasColorscale(trace, 'marker.line')) { | ||
| calcColorscale(trace, marker.line.color, 'marker.line', 'c'); | ||
| if(subTypes.hasMarkers(trace)) { | ||
| if(hasColorscale(trace, 'marker')) { | ||
| calcColorscale(trace, trace.marker.color, 'marker', 'c'); | ||
| } | ||
| if(hasColorscale(trace, 'marker.line')) { | ||
| calcColorscale(trace, trace.marker.line.color, 'marker.line', 'c'); | ||
| } | ||
| } | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -204,7 +204,7 @@ function convertPlotlyOptions(scene, data) { | ||
| }; | ||
| if('line' in data) { | ||
| params.lineColor = str2RgbaArray(line.color); | ||
| params.lineColor = formatColor(line, 1, len); | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice. | ||
| params.lineWidth = line.width; | ||
| params.lineDashes = line.dash; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -38,7 +38,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout | ||
| if(subTypes.hasLines(traceOut)) { | ||
| coerce('connectgaps'); | ||
| handleLineDefaults(traceIn, traceOut, defaultColor, coerce); | ||
| handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nicely done. | ||
| } | ||
| if(subTypes.hasMarkers(traceOut)) { | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| { | ||
| "data": [ | ||
| { | ||
| "x":[-4,-3,-2,-1,0,1,2,3,4,5,6], | ||
| "y":[11,10,9,7,5,6,4,2,3,1,3], | ||
| "z":[4,5,4,3,2,1,0,-1,-2,-3,-4], | ||
| "mode": "lines", | ||
| "line": { | ||
| "width": 5, | ||
| "color": [ | ||
| "#67001f", | ||
| "#b2182b", | ||
| "#d6604d", | ||
| "#f4a582", | ||
| "#fddbc7", | ||
| "#d1e5f0", | ||
| "#92c5de", | ||
| "#4393c3", | ||
| "#2166ac", | ||
| "#053061" | ||
| ] | ||
| }, | ||
| "type":"scatter3d" | ||
| }, | ||
| { | ||
| "x":[-4,-3,-2,-1,0,1,2,3,4,5,6], | ||
| "y":[7,5,6,4,2,3,1,3,-1,-4,-2], | ||
| "z":[2,3,4,5,4,3,2,1,0,-1,-2], | ||
| "mode": "lines+markers", | ||
| "line": { | ||
| "width": 5, | ||
| "color": [ | ||
| "#67001f", | ||
| "#b2182b", | ||
| "#d6604d", | ||
| "#f4a582", | ||
| "#fddbc7", | ||
| "#d1e5f0", | ||
| "#92c5de", | ||
| "#4393c3", | ||
| "#2166ac", | ||
| "#053061" | ||
| ] | ||
| }, | ||
| "type":"scatter3d" | ||
| } | ||
| ], | ||
| "layout": { | ||
| "title": "Markers should default to line color", | ||
| "height":758, | ||
| "width":1310 | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
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.
nice