Skip to content

Commit

Permalink
[Bars] Force text to be inside if total is to be displayed
Browse files Browse the repository at this point in the history
Contributes to #85
  • Loading branch information
wilhelmhb committed Jan 6, 2021
1 parent 1fd9cee commit b9ea827
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/traces/bar/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
var isHorizontal = (trace.orientation === 'h');

var text = getText(fullLayout, cd, i, xa, ya);
textPosition = getTextPosition(trace, i);
textPosition = getTextPosition(trace, i, fullLayout.displaytotal);

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

function getTextPosition(trace, index) {
function getTextPosition(trace, index, forceInside) {
if(forceInside) return 'inside';
var value = helpers.getValue(trace.textposition, index);
return helpers.coerceEnumerated(attributeTextPosition, value);
}
Expand Down

0 comments on commit b9ea827

Please sign in to comment.