diff --git a/src/components/legend/style.js b/src/components/legend/style.js index 5b2c65dfa85..4b0107b0f4a 100644 --- a/src/components/legend/style.js +++ b/src/components/legend/style.js @@ -171,14 +171,15 @@ function styleBars(d) { .attr('transform', 'translate(20,0)'); barpath.exit().remove(); barpath.each(function(d) { - var w = (d.mlw + 1 || markerLine.width + 1) - 1, - p = d3.select(this); + var p = d3.select(this), + d0 = d[0], + w = (d0.mlw + 1 || markerLine.width + 1) - 1; p.style('stroke-width', w + 'px') - .call(Color.fill, d.mc || marker.color); + .call(Color.fill, d0.mc || marker.color); if(w) { - p.call(Color.stroke, d.mlc || markerLine.color); + p.call(Color.stroke, d0.mlc || markerLine.color); } }); } @@ -193,15 +194,15 @@ function styleBoxes(d) { .attr('d', 'M6,6H-6V-6H6Z') .attr('transform', 'translate(20,0)'); pts.exit().remove(); - pts.each(function(d) { - var w = (d.lw + 1 || trace.line.width + 1) - 1, + pts.each(function() { + var w = trace.line.width, p = d3.select(this); p.style('stroke-width', w + 'px') - .call(Color.fill, d.fc || trace.fillcolor); + .call(Color.fill, trace.fillcolor); if(w) { - p.call(Color.stroke, d.lc || trace.line.color); + p.call(Color.stroke, trace.line.color); } }); } diff --git a/test/image/baselines/bar_marker_array.png b/test/image/baselines/bar_marker_array.png index 69e75166fbf..08d1cec4a7a 100644 Binary files a/test/image/baselines/bar_marker_array.png and b/test/image/baselines/bar_marker_array.png differ diff --git a/test/image/mocks/bar_marker_array.json b/test/image/mocks/bar_marker_array.json index 694383900a6..904d1054a0e 100644 --- a/test/image/mocks/bar_marker_array.json +++ b/test/image/mocks/bar_marker_array.json @@ -19,9 +19,26 @@ "#447adb", "#db5a44", "#447adb" - ] + ], + "line": { + "width": [ + 2, + 3, + 2, + 3 + ], + "color": [ + "red", + "green", + "blue", + "yellow" + ] + } }, "type": "bar" } - ] + ], + "layout": { + "showlegend": true + } }