@@ -1049,11 +1049,16 @@ describe('stacked area', function() {
1049
1049
var xr = [ 2 , 6 ] ;
1050
1050
checkRanges ( {
1051
1051
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 ]
1054
1056
} , 'bottom trace visible: false' ) ;
1055
1057
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 ] ) ;
1057
1062
} )
1058
1063
. then ( function ( ) {
1059
1064
var xr = [ 3 , 5 ] ;
@@ -1072,6 +1077,21 @@ describe('stacked area', function() {
1072
1077
y : [ 0 , 7.37 ] , y2 : [ 0 , 7.37 ] ,
1073
1078
y3 : [ 0 , 1.08 ] , y4 : [ 0 , 1.08 ] , y5 : [ 0 , 105.26 ] , y6 : [ 0 , 105.26 ]
1074
1079
} , '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' ) ;
1075
1095
} )
1076
1096
. catch ( failTest )
1077
1097
. then ( done ) ;
0 commit comments