@@ -59,14 +59,14 @@ proto.handlePick = function(selection) {
59
59
}
60
60
} ;
61
61
62
- function calculateTextOffset ( tp ) {
62
+ function calculateTextOffset ( tp , offsetValue ) {
63
63
//Read out text properties
64
64
var textOffset = [ 0 , 0 ] ;
65
65
if ( Array . isArray ( tp ) ) return [ 0 , - 1 ] ;
66
- if ( tp . indexOf ( 'bottom' ) >= 0 ) textOffset [ 1 ] += 1 ;
67
- if ( tp . indexOf ( 'top' ) >= 0 ) textOffset [ 1 ] -= 1 ;
68
- if ( tp . indexOf ( 'left' ) >= 0 ) textOffset [ 0 ] -= 1 ;
69
- if ( tp . indexOf ( 'right' ) >= 0 ) textOffset [ 0 ] += 1 ;
66
+ if ( tp . indexOf ( 'bottom' ) >= 0 ) textOffset [ 1 ] += offsetValue ;
67
+ if ( tp . indexOf ( 'top' ) >= 0 ) textOffset [ 1 ] -= offsetValue ;
68
+ if ( tp . indexOf ( 'left' ) >= 0 ) textOffset [ 0 ] -= offsetValue ;
69
+ if ( tp . indexOf ( 'right' ) >= 0 ) textOffset [ 0 ] += offsetValue ;
70
70
return textOffset ;
71
71
}
72
72
@@ -149,7 +149,7 @@ function convertPlotlyOptions(scene, data) {
149
149
}
150
150
151
151
if ( 'textposition' in data ) {
152
- params . textOffset = calculateTextOffset ( data . textposition ) ; // arrayOk === false
152
+ params . textOffset = calculateTextOffset ( data . textposition , 1.5 * Math . pow ( scene . dataScale [ 0 ] * scene . dataScale [ 1 ] * scene . dataScale [ 2 ] , 1 / 2 ) * Math . max . apply ( Math , data . marker . size ) ) ; // arrayOk === false
153
153
params . textColor = formatColor ( data . textfont , 1 , len ) ;
154
154
params . textSize = formatParam ( data . textfont . size , len , Lib . identity , 12 ) ;
155
155
params . textFont = data . textfont . family ; // arrayOk === false
0 commit comments