Skip to content

Commit 06f63c7

Browse files
committed
Set default for xanchor dynamically
1 parent 09cb679 commit 06f63c7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/legend/defaults.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ function groupDefaults(legendId, layoutIn, layoutOut, fullData) {
109109
var isPaperY = yref === 'paper';
110110
var isPaperX = xref === 'paper';
111111
var defaultX, defaultY, defaultYAnchor;
112+
var defaultXAnchor = 'left';
112113

113114
// TODO: Adjust default xanchor if needed for container ref?
114115
// TODO: Constrain x or y if container ref to be within 0-1
@@ -142,6 +143,7 @@ function groupDefaults(legendId, layoutIn, layoutOut, fullData) {
142143
defaultX = 1.02;
143144
} else {
144145
defaultX = 1;
146+
defaultXAnchor = 'right';
145147
}
146148
}
147149

@@ -158,7 +160,7 @@ function groupDefaults(legendId, layoutIn, layoutOut, fullData) {
158160
coerce('groupclick');
159161

160162
coerce('x', defaultX);
161-
coerce('xanchor');
163+
coerce('xanchor', defaultXAnchor);
162164
coerce('y', defaultY);
163165
coerce('yanchor', defaultYAnchor);
164166
coerce('valign');

0 commit comments

Comments
 (0)