Skip to content

Commit e9350a5

Browse files
committed
fix 3392 scatter errorbars inherit color
new scatter baselines for error bars should inherit color improved mocks to include marker dot line and marker plus line scenarios new baselines for various scenarios new scatter mocks & fix for scattergl new baselines fix for histogram and bar charts fixes fix2 fix 3392 errorbars inherit color
1 parent 728eacc commit e9350a5

18 files changed

+399
-13
lines changed

src/traces/bar/defaults.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,13 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
7070

7171
handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout);
7272

73+
var lineColor = (traceOut.marker.line || {}).color;
74+
var markerColor = (traceOut.marker || {}).color;
75+
7376
// override defaultColor for error bars with defaultLine
7477
var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults');
75-
errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'y'});
76-
errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'});
78+
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || Color.defaultLine, {axis: 'y'});
79+
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || Color.defaultLine, {axis: 'x', inherit: 'y'});
7780

7881
Lib.coerceSelectionMarkerOpacity(traceOut, coerce);
7982
};

src/traces/histogram/defaults.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,13 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
6262

6363
handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout);
6464

65+
Lib.coerceSelectionMarkerOpacity(traceOut, coerce);
66+
67+
var lineColor = (traceOut.marker.line || {}).color;
68+
var markerColor = (traceOut.marker || {}).color;
69+
6570
// override defaultColor for error bars with defaultLine
6671
var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults');
67-
errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'y'});
68-
errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'});
69-
70-
Lib.coerceSelectionMarkerOpacity(traceOut, coerce);
72+
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || Color.defaultLine, {axis: 'y'});
73+
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || Color.defaultLine, {axis: 'x', inherit: 'y'});
7174
};

src/traces/scatter/defaults.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,17 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
7171
if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce);
7272
}
7373

74+
var lineColor = (traceOut.line || {}).color;
75+
var markerColor = (traceOut.marker || {}).color;
76+
7477
if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') {
7578
dfltHoverOn.push('fills');
7679
}
7780
coerce('hoveron', dfltHoverOn.join('+') || 'points');
7881
if(traceOut.hoveron !== 'fills') coerce('hovertemplate');
7982
var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults');
80-
errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'y'});
81-
errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'});
83+
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'y'});
84+
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'x', inherit: 'y'});
8285

8386
Lib.coerceSelectionMarkerOpacity(traceOut, coerce);
8487
};

src/traces/scatter3d/defaults.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
6262
}
6363

6464
var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults');
65-
errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'z'});
66-
errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'y', inherit: 'z'});
67-
errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'z'});
65+
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'z'});
66+
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'y', inherit: 'z'});
67+
errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'x', inherit: 'z'});
6868
};
6969

7070
function handleXYZDefaults(traceIn, traceOut, coerce, layout) {

src/traces/scattergl/defaults.js

+5-2
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/baselines/benchmarks.png

57 Bytes
Loading
1 Byte
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"data": [
3+
{
4+
"x": [0, 1, 5, 6, 0],
5+
"type": "histogram",
6+
"barmode": "stack",
7+
"error_y": {
8+
"type": "sqrt"
9+
}
10+
},
11+
{
12+
"x": [1, 2, 6, 7, 1],
13+
"type": "histogram",
14+
"barmode": "stack",
15+
"marker": {
16+
"line": {
17+
"width": 2,
18+
"color": "gray"
19+
}
20+
},
21+
"error_y": {
22+
"type": "sqrt"
23+
}
24+
},
25+
{
26+
"x": [2, 3, 7, 8, 2],
27+
"type": "histogram",
28+
"barmode": "stack",
29+
"marker": {
30+
"color": "red"
31+
},
32+
"error_y": {
33+
"type": "sqrt"
34+
}
35+
},
36+
{
37+
"x": [3, 4, 8, 9, 3],
38+
"type": "histogram",
39+
"barmode": "stack",
40+
"marker": {
41+
"line": {
42+
"color": "green"
43+
}
44+
},
45+
"error_y": {
46+
"type": "sqrt"
47+
}
48+
},
49+
{
50+
"x": [4, 5, 9, 10, 4],
51+
"type": "histogram",
52+
"barmode": "stack",
53+
"marker": {
54+
"line": {
55+
"color": "blue"
56+
},
57+
"color": "black"
58+
},
59+
"error_y": {
60+
"type": "sqrt"
61+
}
62+
}
63+
],
64+
"layout": {
65+
"width": 600,
66+
"heigh": 600,
67+
"title": {
68+
"text": "Histogram error bars inherit color from marker.line or marker"
69+
}
70+
}
71+
}
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": "scatter",
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": "scatter",
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": "scatter",
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": "scatter",
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": "scatter",
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 error bars inherit color from line or marker"
72+
}
73+
}
74+
}
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"data": [
3+
{
4+
"x": [0, 1, 2, 3, 4],
5+
"y": [0, 100, 500, 600, 0],
6+
"type": "bar",
7+
"barmode": "group",
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": "bar",
16+
"barmode": "group",
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": "bar",
31+
"barmode": "group",
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": "bar",
43+
"barmode": "group",
44+
"marker": {
45+
"line": {
46+
"color": "green"
47+
}
48+
},
49+
"error_y": {
50+
"type": "sqrt"
51+
}
52+
},
53+
{
54+
"x": [0, 1, 2, 3, 4],
55+
"y": [400, 500, 900, 1000, 400],
56+
"type": "bar",
57+
"barmode": "group",
58+
"marker": {
59+
"line": {
60+
"color": "blue"
61+
},
62+
"color": "black"
63+
},
64+
"error_y": {
65+
"type": "sqrt"
66+
}
67+
}
68+
],
69+
"layout": {
70+
"width": 600,
71+
"heigh": 600,
72+
"title": {
73+
"text": "Bar chart error bars inherit color from marker.line or marker"
74+
}
75+
}
76+
}

0 commit comments

Comments
 (0)