Skip to content

Commit b9ea827

Browse files
committed
[Bars] Force text to be inside if total is to be displayed
Contributes to #85
1 parent 1fd9cee commit b9ea827

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: src/traces/bar/plot.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
298298
var isHorizontal = (trace.orientation === 'h');
299299

300300
var text = getText(fullLayout, cd, i, xa, ya);
301-
textPosition = getTextPosition(trace, i);
301+
textPosition = getTextPosition(trace, i, fullLayout.displaytotal);
302302

303303
// compute text position
304304
var inStackOrRelativeMode =
@@ -673,7 +673,8 @@ function getText(fullLayout, cd, index, xa, ya) {
673673
return helpers.coerceString(attributeText, value);
674674
}
675675

676-
function getTextPosition(trace, index) {
676+
function getTextPosition(trace, index, forceInside) {
677+
if(forceInside) return 'inside';
677678
var value = helpers.getValue(trace.textposition, index);
678679
return helpers.coerceEnumerated(attributeTextPosition, value);
679680
}

0 commit comments

Comments
 (0)