diff --git a/src/components/legend/style.js b/src/components/legend/style.js index 5b2c65dfa85..5c5eaeca146 100644 --- a/src/components/legend/style.js +++ b/src/components/legend/style.js @@ -24,24 +24,29 @@ module.exports = function style(s) { s.each(function(d) { var traceGroup = d3.select(this); - var fill = traceGroup + var layers = traceGroup.selectAll('g.layers') + .data([0]); + layers.enter().append('g') + .classed('layers', true); + layers.style('opacity', d[0].trace.opacity); + + var fill = layers .selectAll('g.legendfill') .data([d]); fill.enter().append('g') .classed('legendfill', true); - var line = traceGroup + var line = layers .selectAll('g.legendlines') .data([d]); line.enter().append('g') .classed('legendlines', true); - var symbol = traceGroup + var symbol = layers .selectAll('g.legendsymbols') .data([d]); symbol.enter().append('g') .classed('legendsymbols', true); - symbol.style('opacity', d[0].trace.opacity); symbol.selectAll('g.legendpoints') .data([d]) diff --git a/test/image/baselines/17.png b/test/image/baselines/17.png index 46d10e507a2..953ec288684 100644 Binary files a/test/image/baselines/17.png and b/test/image/baselines/17.png differ diff --git a/test/image/baselines/28.png b/test/image/baselines/28.png index bcd2b96b1f1..81c03a292af 100644 Binary files a/test/image/baselines/28.png and b/test/image/baselines/28.png differ diff --git a/test/image/baselines/gl2d_17.png b/test/image/baselines/gl2d_17.png index 46690caf13c..739c3b80cf0 100644 Binary files a/test/image/baselines/gl2d_17.png and b/test/image/baselines/gl2d_17.png differ diff --git a/test/image/baselines/gl2d_connect_gaps.png b/test/image/baselines/gl2d_connect_gaps.png index fd0efd724e2..8c596c08568 100644 Binary files a/test/image/baselines/gl2d_connect_gaps.png and b/test/image/baselines/gl2d_connect_gaps.png differ diff --git a/test/image/baselines/gl3d_cube.png b/test/image/baselines/gl3d_cube.png index 8991b54ed9a..7dcd976113a 100644 Binary files a/test/image/baselines/gl3d_cube.png and b/test/image/baselines/gl3d_cube.png differ diff --git a/test/image/baselines/line_scatter.png b/test/image/baselines/line_scatter.png index 1791dccb1e7..9e2544a3c23 100644 Binary files a/test/image/baselines/line_scatter.png and b/test/image/baselines/line_scatter.png differ diff --git a/test/image/mocks/line_scatter.json b/test/image/mocks/line_scatter.json index 88061325587..295e914dc8e 100644 --- a/test/image/mocks/line_scatter.json +++ b/test/image/mocks/line_scatter.json @@ -14,7 +14,10 @@ 17 ], "mode": "markers", - "type": "scatter" + "type": "scatter", + "marker": { + "opacity": 0.5 + } }, { "x": [ @@ -30,7 +33,8 @@ 9 ], "mode": "lines", - "type": "scatter" + "type": "scatter", + "opacity": 0.5 }, { "x": [ @@ -46,7 +50,18 @@ 12 ], "mode": "lines+markers", - "type": "scatter" + "type": "scatter", + "opacity": 0.707, + "marker": { + "opacity": 0.707 + } + }, + { + "x": [1, 2, 3], + "y": [1, 2, 3], + "opacity": 0.2, + "line": { "width": 10, "color": "red"}, + "marker": { "size": 20, "color": "blue"} } ] }