@@ -983,6 +983,50 @@ describe('Test splom interactions:', function() {
983983 . catch ( failTest )
984984 . then ( done ) ;
985985 } ) ;
986+
987+ it ( '@gl should not fail when editing graph with visible:false traces' , function ( done ) {
988+ Plotly . plot ( gd , [ {
989+ type : 'splom' ,
990+ dimensions : [ { values : [ ] } , { values : [ ] } ]
991+ } , {
992+ type : 'splom' ,
993+ dimensions : [ { values : [ 1 , 2 , 3 ] } , { values : [ 2 , 3 , 4 ] } ]
994+ } ] )
995+ . then ( function ( ) {
996+ var fullData = gd . _fullData ;
997+ var fullLayout = gd . _fullLayout ;
998+ var splomScenes = fullLayout . _splomScenes ;
999+ var opts = splomScenes [ fullData [ 1 ] . uid ] . matrixOptions ;
1000+
1001+ expect ( fullData [ 0 ] . visible ) . toBe ( false , 'trace 0 visible' ) ;
1002+ expect ( fullData [ 1 ] . visible ) . toBe ( true , 'trace 1 visible' ) ;
1003+ expect ( Object . keys ( splomScenes ) . length ) . toBe ( 1 , '# of splom scenes' ) ;
1004+
1005+ expect ( opts . opacity ) . toBe ( 1 , 'marker opacity' ) ;
1006+ expect ( opts . color ) . toEqual ( new Uint8Array ( [ 255 , 127 , 14 , 255 ] ) , 'marker color' ) ;
1007+ expect ( opts . colors ) . toBe ( undefined , 'marker colors' ) ;
1008+
1009+ return Plotly . restyle ( gd , 'marker.opacity' , [ undefined , [ 0.2 , 0.3 , 0.4 ] ] ) ;
1010+ } )
1011+ . then ( function ( ) {
1012+ var fullData = gd . _fullData ;
1013+ var fullLayout = gd . _fullLayout ;
1014+ var opts = fullLayout . _splomScenes [ fullData [ 1 ] . uid ] . matrixOptions ;
1015+
1016+ // ignored by regl-splom
1017+ expect ( opts . opacity ) . toBe ( 1 , 'marker opacity' ) ;
1018+ // ignored by regl-splom
1019+ expect ( opts . color ) . toEqual ( new Uint8Array ( [ 255 , 127 , 14 , 255 ] ) , 'marker color' ) ;
1020+ // marker.opacity applied here
1021+ expect ( opts . colors ) . toBeCloseTo2DArray ( [
1022+ [ 1 , 0.498 , 0.0549 , 0.2 ] ,
1023+ [ 1 , 0.498 , 0.0549 , 0.3 ] ,
1024+ [ 1 , 0.498 , 0.0549 , 0.4 ]
1025+ ] , 'marker colors' ) ;
1026+ } )
1027+ . catch ( failTest )
1028+ . then ( done ) ;
1029+ } ) ;
9861030} ) ;
9871031
9881032describe ( 'Test splom update switchboard:' , function ( ) {
@@ -1129,6 +1173,31 @@ describe('Test splom update switchboard:', function() {
11291173 expect ( toPlainArray ( scene . matrixOptions . colors [ 2 ] ) )
11301174 . toBeCloseToArray ( [ 0 , 0 , 1 , 1 ] , 1 , msg + '- 2' ) ;
11311175
1176+ return Plotly . restyle ( gd , {
1177+ 'marker.cmin' : - 3 ,
1178+ 'marker.cmax' : 3 ,
1179+ 'marker.color' : [ [ 1 , 2 , 3 ] ]
1180+ } ) ;
1181+ } )
1182+ . then ( function ( ) {
1183+ var msg = 'after colorscale marker.color restyle' ;
1184+
1185+ assertSpies ( msg , [
1186+ [ 'supplyDefaults' , 1 ] ,
1187+ [ 'doCalcdata' , 0 ] ,
1188+ [ 'doTicks' , 0 ] ,
1189+ [ 'clear' , 1 ] ,
1190+ [ 'update' , 1 ] ,
1191+ [ 'draw' , 1 ]
1192+ ] ) ;
1193+
1194+ expect ( toPlainArray ( scene . matrixOptions . colors [ 0 ] ) )
1195+ . toBeCloseToArray ( [ 0.890 , 0.6 , 0.4078 , 1 ] , 1 , msg + '- 0' ) ;
1196+ expect ( toPlainArray ( scene . matrixOptions . colors [ 1 ] ) )
1197+ . toBeCloseToArray ( [ 0.81176 , 0.3333 , 0.2431 , 1 ] , 1 , msg + '- 1' ) ;
1198+ expect ( toPlainArray ( scene . matrixOptions . colors [ 2 ] ) )
1199+ . toBeCloseToArray ( [ 0.6980 , 0.0392 , 0.1098 , 1 ] , 1 , msg + '- 2' ) ;
1200+
11321201 return Plotly . restyle ( gd , 'marker.size' , 20 ) ;
11331202 } )
11341203 . then ( function ( ) {
@@ -1164,6 +1233,22 @@ describe('Test splom update switchboard:', function() {
11641233 expect ( scene . matrixOptions . sizes ) . toBeCloseToArray ( [ 2 , 5 , 10 ] , 1 , msg ) ;
11651234 expect ( gd . _fullLayout . xaxis . range )
11661235 . toBeCloseToArray ( [ 0.853 , 3.235 ] , 1 , 'xrng ' + msg ) ;
1236+
1237+ return Plotly . restyle ( gd , 'marker.symbol' , 'square' ) ;
1238+ } )
1239+ . then ( function ( ) {
1240+ var msg = 'after scalar marker.symbol restyle' ;
1241+
1242+ assertSpies ( msg , [
1243+ [ 'supplyDefaults' , 1 ] ,
1244+ [ 'doCalcdata' , 0 ] ,
1245+ [ 'doTicks' , 0 ] ,
1246+ [ 'clear' , 1 ] ,
1247+ [ 'update' , 1 ] ,
1248+ [ 'draw' , 1 ]
1249+ ] ) ;
1250+
1251+ expect ( scene . matrixOptions . marker ) . not . toBeNull ( msg ) ;
11671252 } )
11681253 . catch ( failTest )
11691254 . then ( done ) ;
0 commit comments