From 8784c7352735ea2f55d5215d6fd74b023d0d868e Mon Sep 17 00:00:00 2001 From: Alex Vinober Date: Tue, 12 Dec 2017 15:35:15 -0500 Subject: [PATCH] Legend lines width --- src/components/legend/attributes.js | 7 +++++++ src/components/legend/defaults.js | 1 + src/components/legend/style.js | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/legend/attributes.js b/src/components/legend/attributes.js index 8b92707afaa..ac2d10ad635 100644 --- a/src/components/legend/attributes.js +++ b/src/components/legend/attributes.js @@ -34,6 +34,13 @@ module.exports = { editType: 'legend', description: 'Sets the width (in px) of the border enclosing the legend.' }, + linewidth: { + valType: 'number', + min: 0, + role: 'style', + editType: 'legend', + description: 'Sets the width (in px) of the legend lines.' + }, font: fontAttrs({ editType: 'legend', description: 'Sets the font used to text the legend items.' diff --git a/src/components/legend/defaults.js b/src/components/legend/defaults.js index a094d5799ba..917c801cc48 100644 --- a/src/components/legend/defaults.js +++ b/src/components/legend/defaults.js @@ -61,6 +61,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { coerce('bgcolor', layoutOut.paper_bgcolor); coerce('bordercolor'); coerce('borderwidth'); + coerce('linewidth'); Lib.coerceFont(coerce, 'font', layoutOut.font); coerce('orientation'); diff --git a/src/components/legend/style.js b/src/components/legend/style.js index 08199c2a888..f3a1a53ee9d 100644 --- a/src/components/legend/style.js +++ b/src/components/legend/style.js @@ -78,10 +78,11 @@ module.exports = function style(s, gd) { var line = d3.select(this).select('.legendlines').selectAll('path') .data(showLine ? [d] : []); + var lineWidth = gd._fullLayout.legend.linewidth; line.enter().append('path').classed('js-line', true) .attr('d', 'M5,0h30'); line.exit().remove(); - line.call(Drawing.lineGroupStyle); + line.call(Drawing.lineGroupStyle, lineWidth); } function stylePoints(d) {