File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -367,10 +367,27 @@ function drawTexts(g, gd) {
367
367
. call ( textLayout )
368
368
. on ( 'edit' , function ( text ) {
369
369
this . attr ( { 'data-unformatted' : text } ) ;
370
+
370
371
this . text ( text )
371
372
. call ( textLayout ) ;
373
+
372
374
if ( ! this . text ( ) ) text = ' \u0020\u0020 ' ;
373
- Plotly . restyle ( gd , 'name' , text , traceIndex ) ;
375
+
376
+ var fullInput = legendItem . trace . _fullInput || { } ,
377
+ astr ;
378
+
379
+ // N.B. this block isn't super clean,
380
+ // and only works for for 'ohlc' and 'candlestick',
381
+ // but should be generalized for other one-to-many transforms
382
+ if ( [ 'ohlc' , 'candlestick' ] . indexOf ( fullInput . type ) !== - 1 ) {
383
+ var transforms = legendItem . trace . transforms ,
384
+ direction = transforms [ transforms . length - 1 ] . direction ;
385
+
386
+ astr = direction + '.legenditem.name' ;
387
+ }
388
+ else astr = 'name' ;
389
+
390
+ Plotly . restyle ( gd , astr , text , traceIndex ) ;
374
391
} ) ;
375
392
}
376
393
else text . call ( textLayout ) ;
You can’t perform that action at this time.
0 commit comments