diff --git a/draftlogs/7845_add.md b/draftlogs/7845_add.md new file mode 100644 index 00000000000..68c0c99b92e --- /dev/null +++ b/draftlogs/7845_add.md @@ -0,0 +1 @@ +- Use dashed markers in legend for shape traces with dash configured [[#7845](https://github.com/plotly/plotly.js/pull/7845)] diff --git a/src/components/legend/style.js b/src/components/legend/style.js index a2a45e9ea5a..466b53cad30 100644 --- a/src/components/legend/style.js +++ b/src/components/legend/style.js @@ -216,9 +216,7 @@ module.exports = function style(s, gd, legend) { dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); dEdit.mlc = boundVal('marker.line.color', pickFirst); dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5], CST_MARKER_LINE_WIDTH); - // TODO: Remove this check in next major version - // Use 'solid' for shapes to match existing behavior - dEdit.mld = trace._isShape ? 'solid' : boundVal('marker.line.dash', pickFirst); + dEdit.mld = boundVal('marker.line.dash', pickFirst); tEdit.marker = { sizeref: 1, sizemin: 1, diff --git a/test/image/baselines/text_on_shapes_basic.png b/test/image/baselines/text_on_shapes_basic.png index 6eb40a22944..23145ce0559 100644 Binary files a/test/image/baselines/text_on_shapes_basic.png and b/test/image/baselines/text_on_shapes_basic.png differ diff --git a/test/jasmine/tests/legend_test.js b/test/jasmine/tests/legend_test.js index c5b252da9b1..97cd23f145a 100644 --- a/test/jasmine/tests/legend_test.js +++ b/test/jasmine/tests/legend_test.js @@ -3200,8 +3200,7 @@ describe('legend with custom legendwidth', function () { .then(done, done.fail); }); - // TODO: Update this test when releasing next major version which will remove the exception for shape traces - it('should apply marker.line.dash to scatter traces but use solid for shape traces', (done) => { + it('should apply marker.line.dash to scatter traces and shape traces', (done) => { const data = [ { type: 'scatter', @@ -3247,7 +3246,7 @@ describe('legend with custom legendwidth', function () { expect(legendItems.length).toBe(2); expect(legendItems[0].style.strokeDasharray).not.toBe(''); - expect(legendItems[1].style.strokeDasharray).toBe(''); + expect(legendItems[1].style.strokeDasharray).not.toBe(''); }) .then(done, done.fail); }); @@ -3498,4 +3497,4 @@ describe('legend title click', function() { } }).then(done, done.fail); }); -}); \ No newline at end of file +});