Skip to content

Commit 93b61bc

Browse files
committed
- modify one test to add GL/REG version
- new test with more overlap with more kind of objects
1 parent f670af2 commit 93b61bc

File tree

3 files changed

+193
-80
lines changed

3 files changed

+193
-80
lines changed

src/traces/scattergl/index.js

+26-25
Original file line numberDiff line numberDiff line change
@@ -259,41 +259,39 @@ function sceneUpdate(gd, subplot) {
259259
// draw traces in proper order
260260
scene.draw = function draw() {
261261
var i;
262-
var allReadyDrawLines = Lib.repeat(false, scene.count);
263-
var allReadyDrawMarkers = Lib.repeat(false, scene.count);
264262
for(i = 0; i < scene.count; i++) {
265263
if(scene.fill2d && scene.fillOptions[i]) {
266264
// must do all fills first
267265
scene.fill2d.draw(i);
268266
if(scene.line2d && scene.lineOptions[i] && (scene.fillOptions[i].fillmode === 'tozeroy' || scene.fillOptions[i].fillmode === 'tozerox')) {
269267
scene.line2d.draw(i);
270-
allReadyDrawLines[i] = true;
268+
if(scene.error2d && scene.errorXOptions[i]) {
269+
scene.error2d.draw(i);
270+
}
271+
if(scene.error2d && scene.errorYOptions[i]) {
272+
scene.error2d.draw(i + scene.count);
273+
}
271274
}
272-
if(scene.scatter2d && scene.markerOptions[i] && (!scene.selectBatch || !scene.selectBatch[i]) && (scene.fillOptions[i].fillmode === 'tozeroy' || scene.fillOptions[i].fillmode === 'tozerox')) {
275+
if(scene.scatter2d && scene.markerOptions[i] && (!scene.selectBatch || !scene.selectBatch[i])) {
273276
// traces in no-selection mode
274277
scene.scatter2d.draw(i);
275-
allReadyDrawMarkers[i] = true;
276278
}
277-
}
278-
}
279-
for(i = 0; i < scene.count; i++) {
280-
if(scene.line2d && scene.lineOptions[i]) {
281-
if(!allReadyDrawLines[i]) {
282-
scene.line2d.draw(i);
283-
}
284-
}
285-
if(scene.error2d && scene.errorXOptions[i]) {
286-
scene.error2d.draw(i);
287-
}
288-
if(scene.error2d && scene.errorYOptions[i]) {
289-
scene.error2d.draw(i + scene.count);
290-
}
291-
if(scene.scatter2d && scene.markerOptions[i] && (!scene.selectBatch || !scene.selectBatch[i])) {
292-
// traces in no-selection mode
293-
if(!allReadyDrawMarkers[i]) {
294-
scene.scatter2d.draw(i);
295-
}
296-
}
279+
} else {
280+
if(scene.line2d && scene.lineOptions[i]) {
281+
scene.line2d.draw(i);
282+
}
283+
if(scene.error2d && scene.errorXOptions[i]) {
284+
scene.error2d.draw(i);
285+
}
286+
if(scene.error2d && scene.errorYOptions[i]) {
287+
scene.error2d.draw(i + scene.count);
288+
}
289+
if(scene.scatter2d && scene.markerOptions[i] && (!scene.selectBatch || !scene.selectBatch[i])) {
290+
// traces in no-selection mode
291+
scene.scatter2d.draw(i);
292+
}
293+
294+
}
297295
}
298296

299297
// draw traces in selection mode
@@ -563,6 +561,9 @@ function plot(gd, subplot, cdata) {
563561
pos = pos.concat(prevLinePos);
564562
fillOptions.hole = hole;
565563
}
564+
console.log(srcPos);
565+
console.log("/\ /\ /\ srcPos / pos \/ \/ \/");
566+
console.log(pos);
566567
fillOptions.fillmode = trace.fill;
567568
fillOptions.opacity = trace.opacity;
568569
fillOptions.positions = pos;
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,141 @@
11
{
22
"data": [
33
{
4-
"x": [null, 3 , 3, null, null
5-
],
4+
"x": [null, 3 , 3, null, null ],
65
"y": [ 25,30,35,40 ,50 ],
76
"type": "scattergl",
87
"fill": "tozerox",
98
"mode": "none",
10-
"showlegend": false, "xaxis": "x", "yaxis": "y" ,
9+
"showlegend": true, "xaxis": "x", "yaxis": "y" ,
1110
"fillcolor": "#FF69B4",
1211
"line": { "color": "#FF69B4" }
1312
},
1413
{
15-
"x": [
16-
null,
17-
null,
18-
null,
19-
5,
20-
5
21-
],
14+
"x": [ null, null, null, 5, 5 ],
2215
"y": [ 25,30,35,40 ,50 ],
2316
"type": "scattergl",
2417
"fill": "tozerox",
2518
"mode": "markers+lines",
26-
"showlegend": false, "xaxis": "x", "yaxis": "y" ,
19+
"showlegend": true, "xaxis": "x", "yaxis": "y" ,
2720
"fillcolor": "#202ff0",
2821
"line": { "color": "#101ff0" }
2922
},
3023
{
31-
"x": [
32-
1,
33-
2,
34-
3,
35-
4,
36-
5
37-
],
38-
"y": [ null, 50, 50,null ,null
39-
],
24+
"x": [null, 3 , 3, null, null ],
25+
"y": [ 25,30,35,40 ,50 ],
26+
"type": "scatter",
27+
"fill": "tozerox",
28+
"mode": "none",
29+
"showlegend": true, "xaxis": "x2", "yaxis": "y2" ,
30+
"fillcolor": "#DD5792",
31+
"line": { "color": "#DD5792" }
32+
},
33+
{
34+
"x": [ null, null, null, 5, 5 ],
35+
"y": [ 25,30,35,40 ,50 ],
36+
"type": "scatter",
37+
"fill": "tozerox",
38+
"mode": "markers+lines",
39+
"showlegend": true, "xaxis": "x2", "yaxis": "y2" ,
40+
"fillcolor": "#000fd0",
41+
"line": { "color": "#0000d0" }
42+
},
43+
{
44+
"x": [ 1, 2, 3, 4, 5 ],
45+
"y": [ null, 50, 50,null ,null ],
4046
"type": "scattergl",
4147
"fill": "tozeroy",
4248
"mode": "none",
43-
"showlegend": false, "xaxis": "x2", "yaxis": "y2" ,
44-
"fillcolor": "#90ff70",
45-
"line": { "color": "#90ff70" }
49+
"showlegend": true, "xaxis": "x3", "yaxis": "y3" ,
50+
"fillcolor": "#80aa70",
51+
"line": { "color": "#80aa70" }
4652
},
4753
{
48-
"x": [
49-
1,
50-
2,
51-
3,
52-
4,
53-
5
54-
],
55-
"y": [null
56-
,null
57-
,null
58-
,
59-
50,
60-
50
61-
],
54+
"x": [ 1, 2, 3, 4, 5 ],
55+
"y": [null ,null ,null , 50, 50 ],
6256
"type": "scattergl",
6357
"fill": "tozeroy",
6458
"mode": "markers+lines",
65-
"showlegend": false, "xaxis": "x2", "yaxis": "y2" ,
66-
"fillcolor": "#f02f20",
67-
"line": { "color": "#f01f10" }
59+
"showlegend": true, "xaxis": "x3", "yaxis": "y3" ,
60+
"fillcolor": "#f09090",
61+
"line": { "color": "#e0b0b0" }
62+
},
63+
{
64+
"x": [ 1, 2, 3, 4, 5 ],
65+
"y": [ null, 50, 50,null ,null ],
66+
"type": "scatter",
67+
"fill": "tozeroy",
68+
"mode": "none",
69+
"showlegend": true, "xaxis": "x4", "yaxis": "y4" ,
70+
"fillcolor": "#608a50",
71+
"line": { "color": "#608a50" }
72+
},
73+
{
74+
"x": [ 1, 2, 3, 4, 5 ],
75+
"y": [null ,null ,null , 50, 50 ],
76+
"type": "scatter",
77+
"fill": "tozeroy",
78+
"mode": "markers+lines",
79+
"showlegend": true, "xaxis": "x4", "yaxis": "y4" ,
80+
"fillcolor": "#e07070",
81+
"line": { "color": "#c09090" }
6882
},
6983
{
70-
"x": [ 1, 1, 2, 3, 4, 5,5
71-
],
72-
"y": [ 0,25,25,25,25,25,0
73-
],
84+
"x": [ 1, 1, 2, 3, 4, 5,5 ],
85+
"y": [ 0,25,25,25,25,25,0 ],
7486
"type": "scattergl",
7587
"fill": "tozeroy",
7688
"mode": "markers+lines",
77-
"showlegend": false, "xaxis": "x3", "yaxis": "y3" ,
89+
"showlegend": true, "xaxis": "x5", "yaxis": "y5" ,
7890
"fillcolor": "#f02f20",
7991
"line": { "color": "#f01f10" }
8092
},
8193
{
82-
"x": [ 1, 2, 2, 3, 4, 4,5
83-
],
84-
"y": [ 0, 0,50,50,50, 0,0
85-
],
94+
"x": [ 1, 2, 2, 3, 4, 4,5 ],
95+
"y": [ 0, 0,50,50,50, 0,0 ],
8696
"type": "scattergl",
8797
"fill": "tozeroy",
8898
"mode": "none",
89-
"showlegend": false, "xaxis": "x3", "yaxis": "y3" ,
99+
"showlegend": true, "xaxis": "x5", "yaxis": "y5" ,
90100
"fillcolor": "#90ff70",
91101
"line": { "color": "#90ff70" }
102+
},
103+
{
104+
"x": [ 1, 1, 2, 3, 4, 5,5 ],
105+
"y": [ 0,25,25,25,25,25,0 ],
106+
"type": "scatter",
107+
"fill": "tozeroy",
108+
"mode": "markers+lines",
109+
"showlegend": true, "xaxis": "x6", "yaxis": "y6" ,
110+
"fillcolor": "#d00f00",
111+
"line": { "color": "#d00000" }
112+
},
113+
{
114+
"x": [ 1, 2, 2, 3, 4, 4,5 ],
115+
"y": [ 0, 0,50,50,50, 0,0 ],
116+
"type": "scatter",
117+
"fill": "tozeroy",
118+
"mode": "none",
119+
"showlegend": true, "xaxis": "x6", "yaxis": "y6" ,
120+
"fillcolor": "#70df50",
121+
"line": { "color": "#70df50" }
92122
}
93123
],
94124
"layout": {
95125
"width": 800,"height": 800,
96-
"margin": {"l": 100, "r": 100, "t": 100, "b": 100},
97-
"grid": {"columns": 1, "rows": 3, "pattern": "independent", "roworder": "bottom to top"} ,
98-
"xaxis" : { "title": "" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
126+
"margin": {"l": 60, "r": 60, "t": 60, "b": 60},
127+
"grid": {"columns": 2, "rows": 3, "pattern": "independent", "roworder": "bottom to top"} ,
128+
"xaxis" : { "title": "GL" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
99129
"xaxis2": { "title": "" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
100-
"xaxis3": { "title": "" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
130+
"xaxis3": { "title": "GL" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
131+
"xaxis4": { "title": "" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
132+
"xaxis5": { "title": "GL" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
133+
"xaxis6": { "title": "" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
101134
"yaxis" : { "title": "" , "type": "linear", "range": [0,60], "nticks": 3 },
102135
"yaxis2": { "title": "" , "type": "linear", "range": [0,60], "nticks": 3 },
103-
"yaxis3": { "title": "" , "type": "linear", "range": [0,60], "nticks": 3 }
136+
"yaxis3": { "title": "" , "type": "linear", "range": [0,60], "nticks": 3 },
137+
"yaxis4": { "title": "" , "type": "linear", "range": [0,60], "nticks": 3 },
138+
"yaxis5": { "title": "" , "type": "linear", "range": [0,60], "nticks": 3 },
139+
"yaxis6": { "title": "" , "type": "linear", "range": [0,60], "nticks": 3 }
104140
}
105141
}
+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"data": [{
3+
"type": "scattergl",
4+
"y": [2, 3, 2, 0],
5+
"xaxis": "x", "yaxis": "y" ,
6+
"error_x": {"value": 0.4, "type": "constant","color":"#028"},
7+
"error_y": {"value": 0.3, "type": "constant","color":"#820"},
8+
"marker": {"color": "#800"},"line": {"color": "#400"}
9+
},{
10+
"type": "scattergl",
11+
"y": [1, 4, 0, 3],
12+
"fillcolor":"#282","fill": "tozeroy", "xaxis": "x", "yaxis": "y" ,
13+
"error_x": {"value": 0.4, "type": "constant","color":"#028"},
14+
"error_y": {"value": 0.3, "type": "constant","color":"#820"},
15+
"marker": {"color": "#060"},"line": {"color": "#030"}
16+
},{
17+
"type": "scatter",
18+
"y": [2, 3, 2, 0],
19+
"xaxis": "x2", "yaxis": "y2" ,
20+
"error_x": {"value": 0.4, "type": "constant","color":"#028"},
21+
"error_y": {"value": 0.3, "type": "constant","color":"#820"},
22+
"marker": {"color": "#088"},"line": {"color": "#044"}
23+
},{
24+
"type": "scatter",
25+
"y": [1, 4, 0, 3],
26+
"fillcolor":"#882","fill": "tozeroy", "xaxis": "x2", "yaxis": "y2" ,
27+
"error_x": {"value": 0.4, "type": "constant","color":"#028"},
28+
"error_y": {"value": 0.3, "type": "constant","color":"#820"},
29+
"marker": {"color": "#660"},"line": {"color": "#330"}
30+
},{
31+
"type": "scattergl",
32+
"y": [2, 3, 2, 0],
33+
"fill": "tozeroy", "xaxis": "x3", "yaxis": "y3" ,
34+
"fillcolor": "#f00",
35+
"error_x": {"value": 0.4, "type": "constant","color":"#028"},
36+
"error_y": {"value": 0.3, "type": "constant","color":"#820"},
37+
"marker": {"color": "#800"},"line": {"color": "#400"}
38+
},{
39+
"type": "scattergl",
40+
"y": [1, 4, 0, 3],
41+
"fill": "tozeroy", "xaxis": "x3", "yaxis": "y3" ,
42+
"fillcolor": "#0c0",
43+
"error_x": {"value": 0.4, "type": "constant","color":"#028"},
44+
"error_y": {"value": 0.3, "type": "constant","color":"#820"},
45+
"marker": {"color": "#060"},"line": {"color": "#030"}
46+
},{
47+
"type": "scatter",
48+
"y": [2, 3, 2, 0],
49+
"fill": "tozeroy", "xaxis": "x4", "yaxis": "y4" ,
50+
"fillcolor": "#f08",
51+
"error_x": {"value": 0.4, "type": "constant","color":"#028"},
52+
"error_y": {"value": 0.3, "type": "constant","color":"#820"},
53+
"marker": {"color": "#088"},"line": {"color": "#044"}
54+
},{
55+
"type": "scatter",
56+
"y": [1, 4, 0, 3],
57+
"fill": "tozeroy", "xaxis": "x4", "yaxis": "y4" ,
58+
"fillcolor": "#0c8",
59+
"error_x": {"value": 0.4, "type": "constant","color":"#028"},
60+
"error_y": {"value": 0.3, "type": "constant","color":"#820"},
61+
"marker": {"color": "#660"},"line": {"color": "#330"}
62+
}],
63+
"layout": {
64+
"width": 800,"height": 800,
65+
"margin": {"l": 100, "r": 100, "t": 100, "b": 100},
66+
"grid": {"columns": 2, "rows": 2, "pattern": "independent", "roworder": "bottom to top"} ,
67+
"xaxis" : { "title": "GL" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
68+
"xaxis2": { "title": "" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
69+
"xaxis3": { "title": "GL" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
70+
"xaxis4": { "title": "" , "type": "linear", "rangemode": "tozero", "nticks": 3 },
71+
"yaxis" : { "title": "GL" , "type": "linear", "range": [-1,5], "nticks": 3 },
72+
"yaxis2": { "title": "" , "type": "linear", "range": [-1,5], "nticks": 3 },
73+
"yaxis3": { "title": "GL" , "type": "linear", "range": [-1,5], "nticks": 3 },
74+
"yaxis4": { "title": "" , "type": "linear", "range": [-1,5], "nticks": 3 }
75+
}
76+
}

0 commit comments

Comments
 (0)