@@ -1049,11 +1049,16 @@ describe('stacked area', function() {
10491049 var xr = [ 2 , 6 ] ;
10501050 checkRanges ( {
10511051 x : xr , x2 : xr , x3 : xr , x4 : xr , x5 : xr , x6 : xr ,
1052- y : [ 0 , 4.21 ] , y2 : [ 0 , 5.26 ] ,
1053- y3 : [ 0 , 1.08 ] , y4 : [ 0 , 1.08 ] , y5 : [ 0 , 105.26 ] , y6 : [ 0 , 105.26 ]
1052+ // now we lose the explicit config from the bottom trace,
1053+ // which we kept when it was visible: 'legendonly'
1054+ y : [ 0 , 4.21 ] , y2 : [ 0 , 4.21 ] ,
1055+ y3 : [ 0 , 4.32 ] , y4 : [ 0 , 1.08 ] , y5 : [ 0 , 105.26 ] , y6 : [ 0 , 5.26 ]
10541056 } , 'bottom trace visible: false' ) ;
10551057
1056- return Plotly . restyle ( gd , 'visible' , false , [ 1 , 4 , 7 , 10 , 13 , 16 ] ) ;
1058+ // put the bottom traces back to legendonly so they still contribute
1059+ // config attributes, and hide the middles too
1060+ return Plotly . restyle ( gd , 'visible' , 'legendonly' ,
1061+ [ 0 , 3 , 6 , 9 , 12 , 15 , 1 , 4 , 7 , 10 , 13 , 16 ] ) ;
10571062 } )
10581063 . then ( function ( ) {
10591064 var xr = [ 3 , 5 ] ;
@@ -1072,6 +1077,21 @@ describe('stacked area', function() {
10721077 y : [ 0 , 7.37 ] , y2 : [ 0 , 7.37 ] ,
10731078 y3 : [ 0 , 1.08 ] , y4 : [ 0 , 1.08 ] , y5 : [ 0 , 105.26 ] , y6 : [ 0 , 105.26 ]
10741079 } , 'top and bottom showing' ) ;
1080+
1081+ return Plotly . restyle ( gd , { x : null , y : null } , [ 0 , 3 , 6 , 9 , 12 , 15 ] ) ;
1082+ } )
1083+ . then ( function ( ) {
1084+ return Plotly . restyle ( gd , 'visible' , true , [ 1 , 4 , 7 , 10 , 13 , 16 ] ) ;
1085+ } )
1086+ . then ( function ( ) {
1087+ var xr = [ 2 , 6 ] ;
1088+ // an invalid trace (no data) implicitly has visible: false, and is
1089+ // equivalent to explicit visible: false in removing stack config.
1090+ checkRanges ( {
1091+ x : xr , x2 : xr , x3 : xr , x4 : xr , x5 : xr , x6 : xr ,
1092+ y : [ 0 , 4.21 ] , y2 : [ 0 , 4.21 ] ,
1093+ y3 : [ 0 , 4.32 ] , y4 : [ 0 , 1.08 ] , y5 : [ 0 , 105.26 ] , y6 : [ 0 , 5.26 ]
1094+ } , 'bottom trace *implicit* visible: false' ) ;
10751095 } )
10761096 . catch ( failTest )
10771097 . then ( done ) ;
0 commit comments