@@ -162,7 +162,7 @@ module.exports = function plot(gd, plotinfo, cdModule, traceLayer) {
162
162
. attr ( 'd' , isBlank ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z' )
163
163
. call ( Drawing . setClipUrl , plotinfo . layerClipId , gd ) ;
164
164
165
- appendBarText ( gd , bar , cd , i , x0 , x1 , y0 , y1 ) ;
165
+ appendBarText ( gd , plotinfo , bar , cd , i , x0 , x1 , y0 , y1 ) ;
166
166
167
167
if ( plotinfo . layerClipId ) {
168
168
Drawing . hideOutsideRangePoint ( di , bar . select ( 'text' ) , xa , ya , trace . xcalendar , trace . ycalendar ) ;
@@ -179,7 +179,7 @@ module.exports = function plot(gd, plotinfo, cdModule, traceLayer) {
179
179
Registry . getComponentMethod ( 'errorbars' , 'plot' ) ( gd , bartraces , plotinfo ) ;
180
180
} ;
181
181
182
- function appendBarText ( gd , bar , calcTrace , i , x0 , x1 , y0 , y1 ) {
182
+ function appendBarText ( gd , plotinfo , bar , calcTrace , i , x0 , x1 , y0 , y1 ) {
183
183
var fullLayout = gd . _fullLayout ;
184
184
var textPosition ;
185
185
@@ -226,6 +226,21 @@ function appendBarText(gd, bar, calcTrace, i, x0, x1, y0, y1) {
226
226
var insideTextFont = style . getInsideTextFont ( trace , i , layoutFont , barColor ) ;
227
227
var outsideTextFont = style . getOutsideTextFont ( trace , i , layoutFont ) ;
228
228
229
+ // Special case: don't use the c2p(v, true) value on log size axes,
230
+ // so that we can get correctly inside text scaling
231
+ var di = bar . datum ( ) ;
232
+ if ( orientation === 'h' ) {
233
+ var xa = plotinfo . xaxis ;
234
+ if ( xa . type === 'log' && di . s0 <= 0 ) {
235
+ x0 = xa . _length ;
236
+ }
237
+ } else {
238
+ var ya = plotinfo . yaxis ;
239
+ if ( ya . type === 'log' && di . s0 <= 0 ) {
240
+ y0 = ya . _length ;
241
+ }
242
+ }
243
+
229
244
// padding excluded
230
245
var barWidth = Math . abs ( x1 - x0 ) - 2 * TEXTPAD ;
231
246
var barHeight = Math . abs ( y1 - y0 ) - 2 * TEXTPAD ;
0 commit comments