diff --git a/src/components/legend/style.js b/src/components/legend/style.js index 277cab88bc3..9d3c7077af9 100644 --- a/src/components/legend/style.js +++ b/src/components/legend/style.js @@ -356,12 +356,27 @@ module.exports = function style(s, gd) { pts.each(function() { var p = d3.select(this); - var w = boundLineWidth(undefined, trace.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH); - p.style('stroke-width', w + 'px') - .call(Color.fill, trace.fillcolor); + if((trace.boxpoints === 'all' || trace.points === 'all') && + Color.opacity(trace.fillcolor) === 0 && Color.opacity((trace.line || {}).color) === 0 + ) { + var tMod = Lib.minExtend(trace, { + marker: { + size: constantItemSizing ? CST_MARKER_SIZE : Lib.constrain(trace.marker.size, 2, 16), + sizeref: 1, + sizemin: 1, + sizemode: 'diameter' + } + }); + pts.call(Drawing.pointStyle, tMod, gd); + } else { + var w = boundLineWidth(undefined, trace.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH); - if(w) Color.stroke(p, trace.line.color); + p.style('stroke-width', w + 'px') + .call(Color.fill, trace.fillcolor); + + if(w) Color.stroke(p, trace.line.color); + } }); } diff --git a/test/image/baselines/box_violin_just_pts.png b/test/image/baselines/box_violin_just_pts.png new file mode 100644 index 00000000000..423da138325 Binary files /dev/null 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 new file mode 100644 index 00000000000..e3d1b11848b --- /dev/null +++ b/test/image/mocks/box_violin_just_pts.json @@ -0,0 +1,147 @@ +{ + "data": [ + { + "type": "box", + "name": "box", + "y": [ + 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": { + "color": "rgba(0, 0, 0, 0)" + }, + "marker": { + "color": "#fc8d62", + "symbol": "cross" + }, + "hoveron": "points" + }, + { + "type": "violin", + "name": "violin", + "y": [ + 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": { + "color": "rgba(0, 0, 0, 0)" + }, + "marker": { + "color": "#8da0cb", + "size": 10, + "line": { + "width": 1 + } + }, + "hoveron": "points" + } + ], + "layout": { + "legend": { + "x": 0, + "y": 1 + } + } +}