Skip to content

Commit b35add8

Browse files
committed
fix shape.name updates via editing legends
1 parent 5b02b62 commit b35add8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/legend/draw.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,9 @@ function drawTexts(g, gd, legendObj) {
526526

527527
if(Registry.hasTransform(fullInput, 'groupby')) {
528528
var groupbyIndices = Registry.getTransformIndices(fullInput, 'groupby');
529-
var index = groupbyIndices[groupbyIndices.length - 1];
529+
var _index = groupbyIndices[groupbyIndices.length - 1];
530530

531-
var kcont = Lib.keyedContainer(fullInput, 'transforms[' + index + '].styles', 'target', 'value.name');
531+
var kcont = Lib.keyedContainer(fullInput, 'transforms[' + _index + '].styles', 'target', 'value.name');
532532

533533
kcont.set(legendItem.trace._group, newName);
534534

@@ -537,7 +537,11 @@ function drawTexts(g, gd, legendObj) {
537537
update.name = newName;
538538
}
539539

540-
return Registry.call('_guiRestyle', gd, update, trace.index);
540+
if(fullInput._isShape) {
541+
return Registry.call('_guiRelayout', gd, 'shapes[' + trace.index + '].name', update.name);
542+
} else {
543+
return Registry.call('_guiRestyle', gd, update, trace.index);
544+
}
541545
});
542546
} else {
543547
textLayout(textEl, g, gd, legendObj);

0 commit comments

Comments
 (0)