@@ -1075,4 +1075,36 @@ describe('grids', function() {
1075
1075
. catch ( failTest )
1076
1076
. then ( done ) ;
1077
1077
} ) ;
1078
+
1079
+ it ( 'places other subplots in the grid by default' , function ( done ) {
1080
+ function checkDomain ( container , column , row , x , y ) {
1081
+ var domain = container . domain ;
1082
+ expect ( domain . row ) . toBe ( row ) ;
1083
+ expect ( domain . column ) . toBe ( column ) ;
1084
+ expect ( domain . x ) . toBeCloseToArray ( x , 3 ) ;
1085
+ expect ( domain . y ) . toBeCloseToArray ( y , 3 ) ;
1086
+ }
1087
+ Plotly . newPlot ( gd , [ {
1088
+ type : 'pie' , labels : [ 'a' , 'b' ] , values : [ 1 , 2 ]
1089
+ } , {
1090
+ type : 'scattergeo' , lon : [ 10 , 20 ] , lat : [ 20 , 10 ]
1091
+ } ] , {
1092
+ grid : { rows : 2 , columns : 2 , xgap : 1 / 3 , ygap : 1 / 3 }
1093
+ } )
1094
+ . then ( function ( ) {
1095
+ // defaults to cell (0, 0)
1096
+ // we're not smart enough to keep them from overlapping each other... should we try?
1097
+ checkDomain ( gd . _fullData [ 0 ] , 0 , 0 , [ 0 , 0.4 ] , [ 0.6 , 1 ] ) ;
1098
+ checkDomain ( gd . _fullLayout . geo , 0 , 0 , [ 0 , 0.4 ] , [ 0.6 , 1 ] ) ;
1099
+
1100
+ return Plotly . update ( gd , { 'domain.column' : 1 } , { 'geo.domain.row' : 1 } , [ 0 ] ) ;
1101
+ } )
1102
+ . then ( function ( ) {
1103
+ // change row OR column, the other keeps its previous default
1104
+ checkDomain ( gd . _fullData [ 0 ] , 1 , 0 , [ 0.6 , 1 ] , [ 0.6 , 1 ] ) ;
1105
+ checkDomain ( gd . _fullLayout . geo , 0 , 1 , [ 0 , 0.4 ] , [ 0 , 0.4 ] ) ;
1106
+ } )
1107
+ . catch ( failTest )
1108
+ . then ( done ) ;
1109
+ } ) ;
1078
1110
} ) ;
0 commit comments