-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
- fix issue scattergl and fill to zero and undefined value #2965
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
Changes from all commits
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 |
---|---|---|
|
@@ -439,10 +439,17 @@ function plot(gd, subplot, cdata) { | |
var pos = [], srcPos = (lineOptions && lineOptions.positions) || stash.positions; | ||
|
||
if(trace.fill === 'tozeroy') { | ||
pos = [srcPos[0], 0]; | ||
pos = pos.concat(srcPos); | ||
pos.push(srcPos[srcPos.length - 2]); | ||
pos.push(0); | ||
var firstdef = 1; | ||
while(isNaN(srcPos[firstdef])) { | ||
firstdef += 2; | ||
} | ||
var lastdef = srcPos.length - 1; | ||
while(isNaN(srcPos[lastdef])) { | ||
lastdef += -2; | ||
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.
|
||
} | ||
pos = [ srcPos[firstdef - 1], 0 ]; | ||
pos = pos.concat(srcPos.slice(firstdef - 1, lastdef + 1)); | ||
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. 🐎 so we don't need to |
||
pos = pos.concat([ srcPos[lastdef - 1], 0 ]); | ||
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. I notice the existing code didn't take advantage of this, but |
||
} | ||
else if(trace.fill === 'tozerox') { | ||
pos = [0, srcPos[1]]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"data": [ | ||
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. Would you mind renaming this mock Would should probably write down in the CONTRIBUTING file at some point. 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. Good point for this PR - but rather than describing this in |
||
{ | ||
"x": [ | ||
1, | ||
2, | ||
3, | ||
4, | ||
5 | ||
], | ||
"y": [ null | ||
, | ||
100, | ||
100,null | ||
,null | ||
], | ||
"type": "scattergl", | ||
"fill": "tozeroy", | ||
"mode": "none", | ||
"showlegend": false, | ||
"fillcolor": "#90ff70", | ||
"line": { "color": "#90ff70" } | ||
|
||
}, | ||
{ | ||
"x": [ | ||
1, | ||
2, | ||
3, | ||
4, | ||
5 | ||
], | ||
"y": [null | ||
,null | ||
,null | ||
, | ||
100, | ||
100 | ||
], | ||
"type": "scattergl", | ||
"fill": "tozeroy", | ||
"mode": "none", | ||
"showlegend": false, | ||
"fillcolor": "#f02f20", | ||
"line": { "color": "#f02f20" } | ||
} | ||
], | ||
"layout": { | ||
"margin": {"l": 100, "r": 100, "t": 100, "b": 100}, | ||
"yaxis": { "title": "Y axis 2 ", "type": "linear", "rangemode": "tozero", "nticks": 3 } | ||
} | ||
} |
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.
oh hmm - this checks for invalid
y
, what about invalidx
?