File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 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) {
367367 . call ( textLayout )
368368 . on ( 'edit' , function ( text ) {
369369 this . attr ( { 'data-unformatted' : text } ) ;
370+
370371 this . text ( text )
371372 . call ( textLayout ) ;
373+
372374 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 ) ;
374391 } ) ;
375392 }
376393 else text . call ( textLayout ) ;
You can’t perform that action at this time.
0 commit comments