Skip to content

Commit 9ebb1af

Browse files
committed
set by default for bar traces with
1 parent e2abf6e commit 9ebb1af

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/traces/bar/defaults.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,17 @@ function handleText(traceIn, traceOut, layout, coerce, textposition, opts) {
148148
if(moduleHasSelected) coerce('selected.textfont.color');
149149
if(moduleHasUnselected) coerce('unselected.textfont.color');
150150
if(moduleHasConstrain) coerce('constraintext');
151-
if(moduleHasCliponaxis) coerce('cliponaxis');
151+
if(moduleHasCliponaxis) {
152+
if(traceOut.text && textposition === 'outside') {
153+
// When `textposition` is `'outside'`, bar labels are very frequently clipped
154+
// since text is not included in autorange calculations.
155+
// So we set `cliponaxis` to `false` by default in that case to prevent clipping;
156+
// otherwise we use the normal default for `cliponaxis`, which is `true`.
157+
coerce('cliponaxis', false);
158+
} else {
159+
coerce('cliponaxis');
160+
}
161+
}
152162
if(moduleHasTextangle) coerce('textangle');
153163

154164
coerce('texttemplate');

0 commit comments

Comments
 (0)