Skip to content

Commit 6bfe109

Browse files
committed
new scatter mocks & fix for scattergl
1 parent 73a1695 commit 6bfe109

File tree

4 files changed

+89
-12
lines changed

4 files changed

+89
-12
lines changed

src/traces/scattergl/defaults.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
5555
handleTextDefaults(traceIn, traceOut, layout, coerce);
5656
}
5757

58+
var lineColor = (traceOut.line || {}).color;
59+
var markerColor = (traceOut.marker || {}).color;
60+
5861
coerce('fill');
5962
if(traceOut.fill !== 'none') {
6063
handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);
6164
}
6265

6366
var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults');
64-
errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'y'});
65-
errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'});
67+
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'y'});
68+
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'x', inherit: 'y'});
6669

6770
Lib.coerceSelectionMarkerOpacity(traceOut, coerce);
6871
};

test/image/mocks/gl2d_scatter_error_bars_inherit_color.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"data": [
33
{
44
"x": [0, 1, 2, 3, 4],
5-
"y": [100, 200, 600, 700, 100],
5+
"y": [0, 100, 500, 600, 0],
66
"type": "scatter",
77
"mode": "markers+lines",
88
"error_y": {
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"x": [0, 1, 2, 3, 4],
14-
"y": [0, 100, 500, 600, 0],
14+
"y": [100, 200, 600, 700, 100],
1515
"type": "scatter",
1616
"mode": "markers+lines",
1717
"marker": {
@@ -30,7 +30,7 @@
3030
"type": "scatter",
3131
"mode": "markers+lines",
3232
"marker": {
33-
"color": "green"
33+
"color": "red"
3434
},
3535
"error_y": {
3636
"type": "sqrt"
@@ -42,7 +42,7 @@
4242
"type": "scatter",
4343
"mode": "markers+lines",
4444
"line": {
45-
"color": "red"
45+
"color": "green"
4646
},
4747
"error_y": {
4848
"type": "sqrt"
@@ -54,10 +54,10 @@
5454
"type": "scatter",
5555
"mode": "markers+lines",
5656
"line": {
57-
"color": "red"
57+
"color": "blue"
5858
},
5959
"marker": {
60-
"color": "green"
60+
"color": "black"
6161
},
6262
"error_y": {
6363
"type": "sqrt"
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"data": [
3+
{
4+
"x": [0, 1, 2, 3, 4],
5+
"y": [0, 100, 500, 600, 0],
6+
"type": "scattergl",
7+
"mode": "markers+lines",
8+
"error_y": {
9+
"type": "sqrt"
10+
}
11+
},
12+
{
13+
"x": [0, 1, 2, 3, 4],
14+
"y": [100, 200, 600, 700, 100],
15+
"type": "scattergl",
16+
"mode": "markers+lines",
17+
"marker": {
18+
"line": {
19+
"width": 2,
20+
"color": "gray"
21+
}
22+
},
23+
"error_y": {
24+
"type": "sqrt"
25+
}
26+
},
27+
{
28+
"x": [0, 1, 2, 3, 4],
29+
"y": [200, 300, 700, 800, 200],
30+
"type": "scattergl",
31+
"mode": "markers+lines",
32+
"marker": {
33+
"color": "red"
34+
},
35+
"error_y": {
36+
"type": "sqrt"
37+
}
38+
},
39+
{
40+
"x": [0, 1, 2, 3, 4],
41+
"y": [300, 400, 800, 900, 300],
42+
"type": "scattergl",
43+
"mode": "markers+lines",
44+
"line": {
45+
"color": "green"
46+
},
47+
"error_y": {
48+
"type": "sqrt"
49+
}
50+
},
51+
{
52+
"x": [0, 1, 2, 3, 4],
53+
"y": [400, 500, 900, 1000, 400],
54+
"type": "scattergl",
55+
"mode": "markers+lines",
56+
"line": {
57+
"color": "blue"
58+
},
59+
"marker": {
60+
"color": "black"
61+
},
62+
"error_y": {
63+
"type": "sqrt"
64+
}
65+
}
66+
],
67+
"layout": {
68+
"width": 600,
69+
"heigh": 600,
70+
"title": {
71+
"text": "Scatter-gl error bars inherit color from line or marker"
72+
}
73+
}
74+
}

test/image/mocks/gl3d_scatter3d_error_bars_inherit_color.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"type": "scatter3d",
3434
"mode": "markers+lines",
3535
"marker": {
36-
"color": "green"
36+
"color": "red"
3737
},
3838
"error_y": {
3939
"type": "sqrt"
@@ -46,7 +46,7 @@
4646
"type": "scatter3d",
4747
"mode": "markers+lines",
4848
"line": {
49-
"color": "red"
49+
"color": "green"
5050
},
5151
"error_y": {
5252
"type": "sqrt"
@@ -59,10 +59,10 @@
5959
"type": "scatter3d",
6060
"mode": "markers+lines",
6161
"line": {
62-
"color": "red"
62+
"color": "blue"
6363
},
6464
"marker": {
65-
"color": "green"
65+
"color": "black"
6666
},
6767
"error_y": {
6868
"type": "sqrt"

0 commit comments

Comments
 (0)