diff --git a/src/components/legend/attributes.js b/src/components/legend/attributes.js index f294d2471f0..f0a94879862 100644 --- a/src/components/legend/attributes.js +++ b/src/components/legend/attributes.js @@ -74,6 +74,19 @@ module.exports = { 'Sets the amount of vertical space (in px) between legend groups.' ].join(' ') }, + entrywidth: { + valType: 'number', + min: 0, + editType: 'legend', + description: 'Sets the width (in px or fraction) of the legend.', + }, + entrywidthmode: { + valType: 'enumerated', + values: ['fraction', 'pixels'], + dflt: 'pixels', + editType: 'legend', + description: 'Determines what entrywidth means.', + }, itemsizing: { valType: 'enumerated', values: ['trace', 'constant'], diff --git a/src/components/legend/defaults.js b/src/components/legend/defaults.js index 70afc29ab33..a2bfc776848 100644 --- a/src/components/legend/defaults.js +++ b/src/components/legend/defaults.js @@ -122,6 +122,8 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { coerce('traceorder', defaultOrder); if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); + coerce('entrywidth'); + coerce('entrywidthmode'); coerce('itemsizing'); coerce('itemwidth'); diff --git a/src/components/legend/draw.js b/src/components/legend/draw.js index 7d0ff625fb5..11f81d2185c 100644 --- a/src/components/legend/draw.js +++ b/src/components/legend/draw.js @@ -351,6 +351,23 @@ function _draw(gd, legendObj) { }], gd); } +function getTraceWidth(trace, legendObj, textGap) { + var legendItem = trace[0]; + var legendWidth = legendItem.width; + + var traceLegendWidth = legendItem.trace.legendwidth || legendObj.entrywidth; + + if(traceLegendWidth) { + if(legendObj.entrywidthmode === 'pixels') { + return traceLegendWidth + textGap; + } else { + return legendObj._maxWidth * traceLegendWidth; + } + } + + return legendWidth + textGap; +} + function clickOrDoubleClick(gd, legend, legendItem, numClicks, evt) { var trace = legendItem.data()[0][0].trace; var evtData = { @@ -636,6 +653,7 @@ function computeLegendDimensions(gd, groups, traces, legendObj) { var isAbovePlotArea = legendObj.y > 1 || (legendObj.y === 1 && yanchor === 'bottom'); var traceGroupGap = legendObj.tracegroupgap; + var legendGroupWidths = {}; // - if below/above plot area, give it the maximum potential margin-push value // - otherwise, extend the height of the plot area @@ -688,7 +706,7 @@ function computeLegendDimensions(gd, groups, traces, legendObj) { var maxItemWidth = 0; var combinedItemWidth = 0; traces.each(function(d) { - var w = d[0].width + textGap; + var w = getTraceWidth(d, legendObj, textGap); maxItemWidth = Math.max(maxItemWidth, w); combinedItemWidth += w; }); @@ -704,7 +722,7 @@ function computeLegendDimensions(gd, groups, traces, legendObj) { var maxWidthInGroup = 0; var offsetY = 0; d3.select(this).selectAll('g.traces').each(function(d) { - var w = d[0].width; + var w = getTraceWidth(d, legendObj, textGap); var h = d[0].height; Drawing.setTranslate(this, @@ -712,7 +730,8 @@ function computeLegendDimensions(gd, groups, traces, legendObj) { titleSize[1] + bw + itemGap + h / 2 + offsetY ); offsetY += h; - maxWidthInGroup = Math.max(maxWidthInGroup, textGap + w); + maxWidthInGroup = Math.max(maxWidthInGroup, w); + legendGroupWidths[d[0].trace.legendgroup] = maxWidthInGroup; }); var next = maxWidthInGroup + itemGap; @@ -750,8 +769,12 @@ function computeLegendDimensions(gd, groups, traces, legendObj) { var rowWidth = 0; traces.each(function(d) { var h = d[0].height; - var w = textGap + d[0].width; - var next = (oneRowLegend ? w : maxItemWidth) + itemGap; + var w = getTraceWidth(d, legendObj, textGap, isGrouped); + var next = (oneRowLegend ? w : maxItemWidth); + + if(legendObj.entrywidthmode !== 'fraction') { + next += itemGap; + } if((next + bw + offsetX - itemGap) >= legendObj._maxWidth) { maxRowWidth = Math.max(maxRowWidth, rowWidth); @@ -802,8 +825,15 @@ function computeLegendDimensions(gd, groups, traces, legendObj) { traces.each(function(d) { var traceToggle = d3.select(this).select('.legendtoggle'); var h = d[0].height; - var w = isEditable ? textGap : (toggleRectWidth || (textGap + d[0].width)); - if(!isVertical) w += itemGap / 2; + var legendgroup = d[0].trace.legendgroup; + var traceWidth = getTraceWidth(d, legendObj, textGap); + if(isGrouped && legendgroup !== '') { + traceWidth = legendGroupWidths[legendgroup]; + } + var w = isEditable ? textGap : (toggleRectWidth || traceWidth); + if(!isVertical && legendObj.entrywidthmode !== 'fraction') { + w += itemGap / 2; + } Drawing.setRect(traceToggle, 0, -h / 2, w, h); }); } diff --git a/src/plots/attributes.js b/src/plots/attributes.js index f90582ec200..9f9952cbfc5 100644 --- a/src/plots/attributes.js +++ b/src/plots/attributes.js @@ -72,6 +72,12 @@ module.exports = { 'and ranks greater than 1000 to go after all unranked items.' ].join(' ') }, + legendwidth: { + valType: 'number', + min: 0, + editType: 'style', + description: 'Sets the width (in px or fraction) of the legend for this trace.', + }, opacity: { valType: 'number', min: 0, diff --git a/src/plots/plots.js b/src/plots/plots.js index e7018f70647..a29f912092d 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -1320,6 +1320,7 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac 'showlegend' ); + coerce('legendwidth'); coerce('legendgroup'); coerce('legendgrouptitle.text'); coerce('legendrank'); diff --git a/test/jasmine/tests/legend_test.js b/test/jasmine/tests/legend_test.js index f1c71c12bd3..2a68e6b753a 100644 --- a/test/jasmine/tests/legend_test.js +++ b/test/jasmine/tests/legend_test.js @@ -6,6 +6,7 @@ var DBLCLICKDELAY = require('@src/plot_api/plot_config').dfltConfig.doubleClickD var Legend = require('@src/components/legend'); var getLegendData = require('@src/components/legend/get_legend_data'); var helpers = require('@src/components/legend/helpers'); +var constants = require('@src/components/legend/constants'); var d3Select = require('../../strict-d3').select; var d3SelectAll = require('../../strict-d3').selectAll; @@ -2345,3 +2346,87 @@ describe('legend with custom doubleClickDelay', function() { .then(done, done.fail); }, 3 * jasmine.DEFAULT_TIMEOUT_INTERVAL); }); + +describe('legend with custom legendwidth', function() { + var gd; + + var data = [ + {x: [1, 2, 1], y: [1, 2, 1], name: 'legend text 1'}, + {x: [2, 1, 2], y: [2, 1, 2], name: 'legend text 12'}, + {x: [2, 3, 4], y: [2, 3, 4], name: 'legend text 123'} + ]; + + var layout = { + legend: { + orientation: 'h' + } + }; + + beforeEach(function() { + gd = createGraphDiv(); + }); + + afterEach(destroyGraphDiv); + + function assertLegendTextWidth(variants) { + var nodes = d3SelectAll('rect.legendtoggle'); + var index = 0; + nodes.each(function() { + var node = d3Select(this); + var w = +node.attr('width'); + if(variants[index]) expect(w).toEqual(variants[index]); + index += 1; + }); + } + + it('should change width when trace has legendwidth', function(done) { + var extendedData = Lib.extendDeep([], data); + extendedData.forEach(function(trace, index) { + trace.legendwidth = (index + 1) * 50; + }); + + var textGap = 30 + constants.itemGap * 2 + constants.itemGap / 2; + + Plotly.newPlot(gd, {data: extendedData, layout: layout}).then(function() { + assertLegendTextWidth([50 + textGap, 100 + textGap, 150 + textGap]); + }).then(done); + }); + + it('should change width when legend has entrywidth', function(done) { + var extendedLayout = Lib.extendDeep([], layout); + var width = 50; + extendedLayout.legend.entrywidth = width; + + var textGap = 30 + constants.itemGap * 2 + constants.itemGap / 2; + + Plotly.newPlot(gd, {data: data, layout: extendedLayout}).then(function() { + assertLegendTextWidth([width + textGap, width + textGap, width + textGap]); + }).then(done); + }); + + it('should change group width when trace has legendwidth', function(done) { + var extendedLayout = Lib.extendDeep([], layout); + extendedLayout.legend.traceorder = 'grouped'; + + var extendedData = Lib.extendDeep([], data); + extendedData[0].legendwidth = 100; + extendedData[0].legendgroup = 'test'; + extendedData[1].legendgroup = 'test'; + + var textGap = 30 + constants.itemGap * 2 + constants.itemGap / 2; + + Plotly.newPlot(gd, {data: extendedData, layout: extendedLayout}).then(function() { + assertLegendTextWidth([100 + textGap, 100 + textGap, undefined]); + }).then(done); + }); + + it('should change width when legend has entrywidth and entrywidthmode is fraction', function(done) { + var extendedLayout = Lib.extendDeep([], layout); + extendedLayout.legend.entrywidthmode = 'fraction'; + extendedLayout.legend.entrywidth = 0.3; + + Plotly.newPlot(gd, {data: data, layout: extendedLayout}).then(function() { + assertLegendTextWidth([162, 162, 162]); + }).then(done); + }); +}); diff --git a/test/plot-schema.json b/test/plot-schema.json index 8aed6ab4651..2eca862f6b2 100644 --- a/test/plot-schema.json +++ b/test/plot-schema.json @@ -2750,6 +2750,22 @@ "valType": "number" }, "editType": "legend", + "entrywidth": { + "description": "Sets the width (in px or fraction) of the legend.", + "editType": "legend", + "min": 0, + "valType": "number" + }, + "entrywidthmode": { + "description": "Determines what entrywidth means.", + "dflt": "pixels", + "editType": "legend", + "valType": "enumerated", + "values": [ + "fraction", + "pixels" + ] + }, "font": { "color": { "editType": "legend", @@ -12610,6 +12626,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "marker": { "autocolorscale": { "description": "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `marker.colorscale`. Has an effect only if in `marker.color` is set to a numerical array. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.", @@ -14125,6 +14147,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "marker": { "autocolorscale": { "description": "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `marker.colorscale`. Has an effect only if in `marker.color` is set to a numerical array. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.", @@ -15419,6 +15447,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the color of line bounding the box(es).", @@ -16738,6 +16772,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "editType": "style", "role": "object", @@ -18234,6 +18274,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "meta": { "arrayOk": true, "description": "Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the trace `meta` values in an attribute in the same trace, simply use `%{meta[i]}` where `i` is the index or key of the `meta` item in question. To access trace `meta` in layout attributes, use `%{data[n[.meta[i]}` where `i` is the index or key of the `meta` and `n` is the trace index.", @@ -19082,6 +19128,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "locationmode": { "description": "Determines the set of locations used to match entries in `locations` to regions on the map. Values *ISO-3*, *USA-states*, *country names* correspond to features on the base map and value *geojson-id* corresponds to features from a custom GeoJSON linked to the `geojson` attribute.", "dflt": "ISO-3", @@ -20069,6 +20121,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "locations": { "description": "Sets which features found in *geojson* to plot using their feature `id` field.", "editType": "calc", @@ -21085,6 +21143,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "lighting": { "ambient": { "description": "Ambient light increases overall color visibility but can wash out the image.", @@ -22277,6 +22341,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the color of the contour level. Has no effect if `contours.coloring` is set to *lines*.", @@ -23515,6 +23585,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the color of the contour level. Has no effect if `contours.coloring` is set to *lines*.", @@ -24464,6 +24540,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "lon": { "description": "Sets the longitude coordinates (in degrees East).", "editType": "calc", @@ -24995,6 +25077,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "marker": { "autocolorscale": { "description": "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `marker.colorscale`. Has an effect only if in `marker.color` is set to a numerical array. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.", @@ -26416,6 +26504,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "marker": { "colors": { "description": "Sets the color of each sector. If not specified, the default trace color set is used to pick the sector colors.", @@ -27486,6 +27580,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "meta": { "arrayOk": true, "description": "Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the trace `meta` values in an attribute in the same trace, simply use `%{meta[i]}` where `i` is the index or key of the `meta` item in question. To access trace `meta` in layout attributes, use `%{data[n[.meta[i]}` where `i` is the index or key of the `meta` and `n` is the trace index.", @@ -28611,6 +28711,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "meta": { "arrayOk": true, "description": "Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the trace `meta` values in an attribute in the same trace, simply use `%{meta[i]}` where `i` is the index or key of the `meta` item in question. To access trace `meta` in layout attributes, use `%{data[n[.meta[i]}` where `i` is the index or key of the `meta` and `n` is the trace index.", @@ -29398,6 +29504,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "marker": { "autocolorscale": { "description": "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `marker.colorscale`. Has an effect only if in `marker.color` is set to a numerical array. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.", @@ -31350,6 +31462,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "marker": { "color": { "description": "Sets the aggregation data.", @@ -32610,6 +32728,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the color of the contour level. Has no effect if `contours.coloring` is set to *lines*.", @@ -33361,6 +33485,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "level": { "anim": true, "description": "Sets the level from which this trace hierarchy is rendered. Set `level` to `''` to start from the root node in the hierarchy. Must be an \"id\" if `ids` is filled in, otherwise plotly attempts to find a matching item in `labels`.", @@ -34570,6 +34700,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "meta": { "arrayOk": true, "description": "Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the trace `meta` values in an attribute in the same trace, simply use `%{meta[i]}` where `i` is the index or key of the `meta` item in question. To access trace `meta` in layout attributes, use `%{data[n[.meta[i]}` where `i` is the index or key of the `meta` and `n` is the trace index.", @@ -35429,6 +35565,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "meta": { "arrayOk": true, "description": "Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the trace `meta` values in an attribute in the same trace, simply use `%{meta[i]}` where `i` is the index or key of the `meta` item in question. To access trace `meta` in layout attributes, use `%{data[n[.meta[i]}` where `i` is the index or key of the `meta` and `n` is the trace index.", @@ -36456,6 +36598,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "lighting": { "ambient": { "description": "Ambient light increases overall color visibility but can wash out the image.", @@ -37733,6 +37881,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "lighting": { "ambient": { "description": "Ambient light increases overall color visibility but can wash out the image.", @@ -38355,6 +38509,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "dash": { "description": "Sets the dash style of lines. Set to a dash type string (*solid*, *dot*, *dash*, *longdash*, *dashdot*, or *longdashdot*) or a dash length list in px (eg *5px,10px,2px,2px*). Note that this style setting can also be set per direction via `increasing.line.dash` and `decreasing.line.dash`.", @@ -38848,6 +39008,12 @@ "valType": "string" } }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "autocolorscale": { "description": "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `line.colorscale`. Has an effect only if in `line.color` is set to a numerical array. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.", @@ -39805,6 +39971,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "autocolorscale": { "description": "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `line.colorscale`. Has an effect only if in `line.color` is set to a numerical array. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.", @@ -41000,6 +41172,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "marker": { "colors": { "description": "Sets the color of each sector. If not specified, the default trace color set is used to pick the sector colors.", @@ -41592,6 +41770,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "marker": { "blend": { "description": "Determines if colors are blended together for a translucency effect in case `opacity` is specified as a value less then `1`. Setting `blend` to `true` reduces zoom/pan speed if used with large numbers of points.", @@ -42050,6 +42234,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "link": { "color": { "arrayOk": true, @@ -43239,6 +43429,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "anim": true, @@ -45496,6 +45692,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "autocolorscale": { "description": "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `line.colorscale`. Has an effect only if in `line.color` is set to a numerical array. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.", @@ -47479,6 +47681,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the line color.", @@ -49300,6 +49508,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the line color.", @@ -51300,6 +51514,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the line color.", @@ -53199,6 +53419,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the line color.", @@ -54364,6 +54590,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the line color.", @@ -56207,6 +56439,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the line color.", @@ -58017,6 +58255,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the line color.", @@ -59858,6 +60102,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the line color.", @@ -61701,6 +61951,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "marker": { "autocolorscale": { "description": "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `marker.colorscale`. Has an effect only if in `marker.color` is set to a numerical array. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.", @@ -63853,6 +64109,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "lighting": { "ambient": { "description": "Ambient light increases overall color visibility but can wash out the image.", @@ -64553,6 +64815,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "level": { "anim": true, "description": "Sets the level from which this trace hierarchy is rendered. Set `level` to `''` to start from the root node in the hierarchy. Must be an \"id\" if `ids` is filled in, otherwise plotly attempts to find a matching item in `labels`.", @@ -66469,6 +66737,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "lighting": { "ambient": { "description": "Ambient light increases overall color visibility but can wash out the image.", @@ -67362,6 +67636,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "meta": { "arrayOk": true, "description": "Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the trace `meta` values in an attribute in the same trace, simply use `%{meta[i]}` where `i` is the index or key of the `meta` item in question. To access trace `meta` in layout attributes, use `%{data[n[.meta[i]}` where `i` is the index or key of the `meta` and `n` is the trace index.", @@ -67768,6 +68048,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "level": { "anim": true, "description": "Sets the level from which this trace hierarchy is rendered. Set `level` to `''` to start from the root node in the hierarchy. Must be an \"id\" if `ids` is filled in, otherwise plotly attempts to find a matching item in `labels`.", @@ -69085,6 +69371,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "line": { "color": { "description": "Sets the color of line bounding the violin(s).", @@ -70869,6 +71161,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "lighting": { "ambient": { "description": "Ambient light increases overall color visibility but can wash out the image.", @@ -71708,6 +72006,12 @@ "editType": "style", "valType": "number" }, + "legendwidth": { + "description": "Sets the width (in px or fraction) of the legend for this trace.", + "editType": "style", + "min": 0, + "valType": "number" + }, "measure": { "description": "An array containing types of values. By default the values are considered as 'relative'. However; it is possible to use 'total' to compute the sums. Also 'absolute' could be applied to reset the computed total or to declare an initial value where needed.", "dflt": [],