@@ -410,26 +410,26 @@ function drawTexts(g, gd) {
410
410
transforms = legendItem . trace . transforms ;
411
411
direction = transforms [ transforms . length - 1 ] . direction ;
412
412
413
- update [ direction + '.name' ] = [ text ] ;
414
- } else {
415
- if ( fullInput . transforms ) {
416
- for ( i = fullInput . transforms . length - 1 ; i >= 0 ; i -- ) {
417
- if ( fullInput . transforms [ i ] . type === 'groupby' ) {
418
- break ;
419
- }
413
+ update [ direction + '.name' ] = text ;
414
+ } else if ( fullInput . transforms ) {
415
+ for ( i = fullInput . transforms . length - 1 ; i >= 0 ; i -- ) {
416
+ if ( fullInput . transforms [ i ] . type === 'groupby' ) {
417
+ break ;
420
418
}
419
+ }
421
420
422
- var carr = Lib . keyedContainer ( fullInput , 'transforms[' + i + '].groupnames' ) ;
421
+ var carr = Lib . keyedContainer ( fullInput , 'transforms[' + i + '].groupnames' ) ;
423
422
424
- if ( BLANK_STRING_REGEX . test ( origText ) ) {
425
- carr . remove ( legendItem . trace . _group ) ;
426
- needsRedraw = true ;
427
- } else {
428
- carr . set ( legendItem . trace . _group , [ text ] ) ;
429
- }
430
-
431
- update = carr . constructUpdate ( ) ;
423
+ if ( BLANK_STRING_REGEX . test ( origText ) ) {
424
+ carr . remove ( legendItem . trace . _group ) ;
425
+ needsRedraw = true ;
426
+ } else {
427
+ carr . set ( legendItem . trace . _group , text ) ;
432
428
}
429
+
430
+ update = carr . constructUpdate ( ) ;
431
+ } else {
432
+ update . name = text ;
433
433
}
434
434
435
435
var p = Plotly . restyle ( gd , update , traceIndex ) ;
0 commit comments