diff --git a/draftlogs/7162_fix.md b/draftlogs/7162_fix.md new file mode 100644 index 00000000000..46247464697 --- /dev/null +++ b/draftlogs/7162_fix.md @@ -0,0 +1 @@ + - Make marker render in legend when line is hidden with a width of 0 [[#7162](https://github.com/plotly/plotly.js/pull/7162)] \ No newline at end of file diff --git a/src/components/legend/style.js b/src/components/legend/style.js index f1400698d8b..d423b61628c 100644 --- a/src/components/legend/style.js +++ b/src/components/legend/style.js @@ -415,7 +415,8 @@ module.exports = function style(s, gd, legend) { var p = d3.select(this); if((trace.boxpoints === 'all' || trace.points === 'all') && - Color.opacity(trace.fillcolor) === 0 && Color.opacity((trace.line || {}).color) === 0 + Color.opacity(trace.fillcolor) === 0 && + (Color.opacity((trace.line || {}).color) === 0 || trace.line.width === 0) ) { var tMod = Lib.minExtend(trace, { marker: { diff --git a/test/image/baselines/box_violin_just_pts.png b/test/image/baselines/box_violin_just_pts.png index 3341caaedb6..47b443fe69b 100644 Binary files a/test/image/baselines/box_violin_just_pts.png and b/test/image/baselines/box_violin_just_pts.png differ diff --git a/test/image/mocks/box_violin_just_pts.json b/test/image/mocks/box_violin_just_pts.json index 59f30de6727..1073fabce73 100644 --- a/test/image/mocks/box_violin_just_pts.json +++ b/test/image/mocks/box_violin_just_pts.json @@ -3,7 +3,7 @@ { "type": "box", "name": "box", - "y": [ + "x": [ 0.21241263286846768, 0.6283132500282779, 2.059323870167601, 2.1935119470597755, 2.7466418942243536, 3.467395904471225, 3.653212884314042, 4.5139456845169, 4.724443983818345, 4.133047160893449, @@ -36,7 +36,7 @@ { "type": "violin", "name": "violin", - "y": [ + "x": [ 0.21241263286846768, 0.6283132500282779, 2.059323870167601, 2.1935119470597755, 2.7466418942243536, 3.467395904471225, 3.653212884314042, 4.5139456845169, 4.724443983818345, 4.133047160893449, @@ -68,7 +68,76 @@ } }, "hoveron": "points" - } + }, + { + "type": "box", + "name": "box width", + "x": [ + 0.21241263286846768, 0.6283132500282779, 2.059323870167601, + 2.1935119470597755, 2.7466418942243536, 3.467395904471225, + 3.653212884314042, 4.5139456845169, 4.724443983818345, 4.133047160893449, + 4.895798280700072, 4.125891534267504, 3.855907668878962, 4.339440306552532, + 3.9878198050969598, 3.387742554567235, 2.4388348464827923, + 2.0196998134080077, 1.6468702894198695, 0.9943017399397437, + 0.6826942300835983, 0.3588816001294317, -0.9408555890714587, + -1.1907113828655032, -1.9452558895288188, -1.8469883412634, + -2.507784709721651, -3.504441099089313, -3.6122982876732115, + -3.9222888530079216, -3.602674433368737, -3.442554012650344, + -3.2412724072298866, -3.5032754904694814, -2.6048370351384453, + -2.2865075287581567, -1.5084596044414513, -1.7217543646801425, + -0.7771982562904898, 0.3107690591528869, 0.25029597778901336, + 0.9298694888494701, 1.378244848035627, 2.354024310314667, + 3.0684405570394957, 3.7112025463924434, 4.007092766797532, + 4.1488920076238145, 4.176421256377431, 4.083935458554087 + ], + "boxpoints": "all", + "pointpos": 0, + "fillcolor": "rgba(0, 0, 0, 0)", + "line": { + "width": 0 + }, + "marker": { + "color": "#fc8d62", + "symbol": "cross" + }, + "hoveron": "points" + }, + { + "type": "violin", + "name": "violin width", + "x": [ + 0.21241263286846768, 0.6283132500282779, 2.059323870167601, + 2.1935119470597755, 2.7466418942243536, 3.467395904471225, + 3.653212884314042, 4.5139456845169, 4.724443983818345, 4.133047160893449, + 4.895798280700072, 4.125891534267504, 3.855907668878962, 4.339440306552532, + 3.9878198050969598, 3.387742554567235, 2.4388348464827923, + 2.0196998134080077, 1.6468702894198695, 0.9943017399397437, + 0.6826942300835983, 0.3588816001294317, -0.9408555890714587, + -1.1907113828655032, -1.9452558895288188, -1.8469883412634, + -2.507784709721651, -3.504441099089313, -3.6122982876732115, + -3.9222888530079216, -3.602674433368737, -3.442554012650344, + -3.2412724072298866, -3.5032754904694814, -2.6048370351384453, + -2.2865075287581567, -1.5084596044414513, -1.7217543646801425, + -0.7771982562904898, 0.3107690591528869, 0.25029597778901336, + 0.9298694888494701, 1.378244848035627, 2.354024310314667, + 3.0684405570394957, 3.7112025463924434, 4.007092766797532, + 4.1488920076238145, 4.176421256377431, 4.083935458554087 + ], + "points": "all", + "pointpos": 0, + "fillcolor": "rgba(0, 0, 0, 0)", + "line": { + "width": 0 + }, + "marker": { + "color": "#8da0cb", + "size": 10, + "line": { + "width": 1 + } + }, + "hoveron": "points" + } ], "layout": { "legend": {