Skip to content

Commit be43294

Browse files
committed
- fix gl2d_scatter_fill_self_next ( rollback the baselines test/image/baselines/gl2d_scatter_fill_self_next.png )
- add a new test with 2 draw side by side
1 parent 95c602e commit be43294

File tree

4 files changed

+86
-5
lines changed

4 files changed

+86
-5
lines changed

src/traces/scattergl/index.js

+36-5
Original file line numberDiff line numberDiff line change
@@ -259,26 +259,57 @@ function sceneUpdate(gd, subplot) {
259259
// draw traces in proper order
260260
scene.draw = function draw() {
261261
var i;
262+
var we_must_draw_previous_line_marker = 0 ;
262263
for(i = 0; i < scene.count; i++) {
264+
var we_defer_somes_draw = 0 ;
265+
if ( scene.fill2d && scene.fillOptions[i] && scene.fillOptions[i].fillmode == "tonext" ) {
266+
we_defer_somes_draw = 1 ;
267+
} else {
268+
if ( we_must_draw_previous_line_marker && scene.line2d && scene.lineOptions[i-1] ) {
269+
scene.line2d.draw(i-1);
270+
}
271+
if ( we_must_draw_previous_line_marker && scene.scatter2d && scene.markerOptions[i-1] ) {
272+
scene.scatter2d.draw(i-1);
273+
}
274+
we_must_draw_previous_line_marker = 0 ;
275+
}
263276
if(scene.fill2d && scene.fillOptions[i]) {
264277
scene.fill2d.draw(i);
265278
}
279+
// we draw line2d
280+
if ( we_must_draw_previous_line_marker && scene.line2d && scene.lineOptions[i-1] ) {
281+
scene.line2d.draw(i-1);
282+
}
266283
if(scene.line2d && scene.lineOptions[i]) {
267-
scene.line2d.draw(i);
284+
if ( we_defer_somes_draw == 0 ) {
285+
scene.line2d.draw(i);
286+
}
268287
}
269288
if(scene.error2d && scene.errorXOptions[i]) {
270289
scene.error2d.draw(i);
271290
}
272291
if(scene.error2d && scene.errorYOptions[i]) {
273292
scene.error2d.draw(i + scene.count);
274293
}
275-
if(scene.scatter2d && scene.markerOptions[i] && (!scene.selectBatch || !scene.selectBatch[i])) {
276-
// traces in no-selection mode
277-
scene.scatter2d.draw(i);
278-
}
294+
// we draw scatter2d
295+
if (!scene.selectBatch || !scene.selectBatch[i]) {
296+
if ( we_must_draw_previous_line_marker && scene.scatter2d && scene.markerOptions[i-1] ) {
297+
scene.scatter2d.draw(i-1);
298+
}
299+
if(scene.scatter2d && scene.markerOptions[i]) {
300+
if ( we_defer_somes_draw == 0 ) {
301+
scene.scatter2d.draw(i);
302+
}
303+
}
304+
}
279305
if(scene.glText[i] && scene.textOptions[i]) {
280306
scene.glText[i].render();
281307
}
308+
if ( we_defer_somes_draw == 1 ) {
309+
we_must_draw_previous_line_marker = 1 ;
310+
} else {
311+
we_must_draw_previous_line_marker = 0 ;
312+
}
282313
}
283314

284315
// draw traces in selection mode
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"data":[
3+
{
4+
"x": [1, 2, 3, 1, null, 4, 5, 6],
5+
"y": [2, 3, 2, 2, null, 3, 4, 3],
6+
"fill": "tonext","fillcolor":"#282", "line": { "color": "#8c8" },
7+
"type": "scattergl"
8+
},
9+
{
10+
"x": [-1, 4, 9, null, 0, 1, 2],
11+
"y": [1, 6, 1, null, 5, 6, 5],
12+
"fill": "tonext","fillcolor":"#822", "line": { "color": "#c88" },
13+
"type": "scattergl"
14+
},
15+
{
16+
"x": [2, 7, 9],
17+
"y": [2, 4, 2],
18+
"fill": "toself","fillcolor":"#228", "line": { "color": "#88c" },
19+
"type": "scattergl"
20+
},
21+
{
22+
"x": [1, 2, 3, 1, null, 4, 5, 6],
23+
"y": [2, 3, 2, 2, null, 3, 4, 3],
24+
"fill": "tonext","fillcolor":"#282", "line": { "color": "#8c8" },
25+
"type": "scatter", "showlegend": true, "xaxis": "x2", "yaxis": "y2"
26+
},
27+
{
28+
"x": [-1, 4, 9, null, 0, 1, 2],
29+
"y": [1, 6, 1, null, 5, 6, 5],
30+
"fill": "tonext","fillcolor":"#822", "line": { "color": "#c88" },
31+
"type": "scatter", "showlegend": true, "xaxis": "x2", "yaxis": "y2"
32+
},
33+
{
34+
"x": [2, 7, 9],
35+
"y": [2, 4, 2],
36+
"fill": "toself","fillcolor":"#228", "line": { "color": "#88c" },
37+
"type": "scatter","showlegend": true, "xaxis": "x2", "yaxis": "y2"
38+
}
39+
],
40+
"layout":{
41+
"title": "Fill toself and tonext",
42+
"width": 600,"height": 400,
43+
"margin": {"l": 20, "r": 40, "t": 40, "b": 40},
44+
"grid": {"columns": 2, "rows": 1, "pattern": "independent", "roworder": "bottom to top"} ,
45+
"xaxis" : { "title": "GL" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
46+
"xaxis2": { "title": "" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
47+
"yaxis" : { "title": "" , "type": "linear", "range": [0,8], "nticks": 3 },
48+
"yaxis2": { "title": "" , "type": "linear", "range": [0,8], "nticks": 3 }
49+
}
50+
}

0 commit comments

Comments
 (0)