Skip to content

Commit 10d9d8e

Browse files
Rename widhmode with entrywidthmode
1 parent 05b6d77 commit 10d9d8e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/components/legend/attributes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module.exports = {
8080
editType: 'legend',
8181
description: 'Sets the width (in px or fraction) of the legend.',
8282
},
83-
widthmode: {
83+
entrywidthmode: {
8484
valType: 'enumerated',
8585
values: ['fraction', 'pixels'],
8686
dflt: 'pixels',

src/components/legend/defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) {
123123
if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap');
124124

125125
coerce('entrywidth');
126-
coerce('widthmode');
126+
coerce('entrywidthmode');
127127
coerce('itemsizing');
128128
coerce('itemwidth');
129129

src/components/legend/draw.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ function getTraceWidth(trace, legendObj, textGap) {
358358
var traceLegendWidth = legendItem.trace.legendwidth || legendObj.entrywidth;
359359

360360
if(traceLegendWidth) {
361-
if(legendObj.widthmode === 'pixels') {
361+
if(legendObj.entrywidthmode === 'pixels') {
362362
return traceLegendWidth + textGap;
363363
} else {
364364
return legendObj._maxWidth * traceLegendWidth;
@@ -772,7 +772,7 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
772772
var w = getTraceWidth(d, legendObj, textGap, isGrouped);
773773
var next = (oneRowLegend ? w : maxItemWidth);
774774

775-
if(legendObj.widthmode !== 'fraction') {
775+
if(legendObj.entrywidthmode !== 'fraction') {
776776
next += itemGap;
777777
}
778778

@@ -831,7 +831,7 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
831831
traceWidth = legendGroupWidths[legendgroup];
832832
}
833833
var w = isEditable ? textGap : (toggleRectWidth || traceWidth);
834-
if(!isVertical && legendObj.widthmode !== 'fraction') {
834+
if(!isVertical && legendObj.entrywidthmode !== 'fraction') {
835835
w += itemGap / 2;
836836
}
837837
Drawing.setRect(traceToggle, 0, -h / 2, w, h);

test/jasmine/tests/legend_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2420,9 +2420,9 @@ describe('legend with custom legendwidth', function() {
24202420
}).then(done);
24212421
});
24222422

2423-
it('should change width when legend has entrywidth and widthmode is fraction', function(done) {
2423+
it('should change width when legend has entrywidth and entrywidthmode is fraction', function(done) {
24242424
var extendedLayout = Lib.extendDeep([], layout);
2425-
extendedLayout.legend.widthmode = 'fraction';
2425+
extendedLayout.legend.entrywidthmode = 'fraction';
24262426
extendedLayout.legend.entrywidth = 0.3;
24272427

24282428
Plotly.newPlot(gd, {data: data, layout: extendedLayout}).then(function() {

0 commit comments

Comments
 (0)