Skip to content

Commit

Permalink
Merge pull request #5355 from ruijin/scattkeep null in x,y so regl kn…
Browse files Browse the repository at this point in the history
…ows the end of polygonergl_fill_fix
  • Loading branch information
archmoj authored Dec 26, 2020
2 parents 278950b + 4775030 commit 4ce0c8b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 87 deletions.
90 changes: 5 additions & 85 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"polybooljs": "^1.2.0",
"regl": "^1.6.1",
"regl-error2d": "^2.0.11",
"regl-line2d": "^3.0.18",
"regl-line2d": "^3.1.0",
"regl-scatter2d": "^3.2.1",
"regl-splom": "^1.0.12",
"right-now": "^1.0.0",
Expand Down
4 changes: 4 additions & 0 deletions src/traces/scattergl/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,14 @@ module.exports = function plot(gd, subplot, cdata) {
} else if(trace.fill === 'toself' || trace.fill === 'tonext') {
pos = [];
last = 0;

fillOptions.splitNull = true;

for(j = 0; j < srcPos.length; j += 2) {
if(isNaN(srcPos[j]) || isNaN(srcPos[j + 1])) {
pos = pos.concat(srcPos.slice(last, j));
pos.push(srcPos[last], srcPos[last + 1]);
pos.push(null, null); // keep null to mark end of polygon
last = j + 2;
}
}
Expand Down
Binary file modified test/image/baselines/gl2d_scatter_fill_self_next.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 23 additions & 1 deletion test/image/mocks/gl2d_scatter_fill_self_next.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,29 @@
"y": [5, 6, 5],
"fill": "toself",
"type": "scattergl"
}
},
{
"x": [1.1, 1.1, 2.1, null,
-1.9,-1.9,-0.9,null,
-4.9,-4.9,-3.9],
"y": [6.1, 7.1, 7.1, null,
1.1, 2.1, 2.1, null,
1.1, 2.1, 2.1],
"type": "scattergl",
"fill": "tonext"
},
{
"x": [ 0, 0, 2, 2, 0, null,
1,1,3,3,1,null,
-2,-2,0,0,-2,null,
-5,-5,-3,-3,-5],
"y": [9, 10, 10, 9, 9, null,
6,8, 8, 6,6,null,
1,3,3,1, 1,null,
1,3,3,1,1],
"type": "scattergl",
"fill": "tonext"
}
],
"layout":{
"title": {"text": "Fill toself and tonext"},
Expand Down

0 comments on commit 4ce0c8b

Please sign in to comment.