File tree Expand file tree Collapse file tree 2 files changed +82
-5
lines changed Expand file tree Collapse file tree 2 files changed +82
-5
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,85 @@ exports.projNames = {
126
126
*/
127
127
} ;
128
128
129
+ var keys = Object . keys ( exports . projNames ) ;
130
+ var totalN = keys . length ;
131
+ var nRow = 8 ;
132
+ var nCol = Math . ceil ( totalN / nRow ) ;
133
+ var layout = {
134
+ grid : {
135
+ rows : nRow ,
136
+ columns : nCol
137
+ } ,
138
+ showlegend : false ,
139
+ width : 650 ,
140
+ height : 1200 ,
141
+ margin : {
142
+ l : 20 ,
143
+ t : 20 ,
144
+ r : 20 ,
145
+ b : 20
146
+ } ,
147
+ annotations : [ {
148
+ showarrow : false ,
149
+ text : 'fitbounds<br>\'locations\'<br>for all<br>projection<br>types' ,
150
+ font : { size : 24 } ,
151
+ x : 1 ,
152
+ xref : 'paper' ,
153
+ xanchor : 'right' ,
154
+ y : 0.1 ,
155
+ yanchor : 'bottom'
156
+ } ] ,
157
+ } ;
158
+ var data = [ ] ;
159
+ var n = - 1 ;
160
+ for ( var col = 0 ; col < nCol ; col ++ ) {
161
+ for ( var row = 0 ; row < nRow ; row ++ ) {
162
+ n ++ ;
163
+ if ( n >= totalN ) continue ;
164
+
165
+ var name = keys [ n ] ;
166
+ var geo = 'geo' + ( n ? n + 1 : '' ) ;
167
+ var usa = name . indexOf ( 'usa' ) !== - 1 ;
168
+ var locationmode = usa ? 'USA-states' : undefined ;
169
+ var locations = [ usa ? 'WA' : 'AUS' ] ;
170
+
171
+ data . push ( {
172
+ name : name ,
173
+ geo : geo ,
174
+ type : 'choropleth' ,
175
+ locationmode : locationmode ,
176
+ locations : locations ,
177
+ z : [ 10 ] ,
178
+ showscale : false ,
179
+ hovertemplate : name
180
+ } ) ;
181
+
182
+ data . push ( {
183
+ geo : geo ,
184
+ type : 'scattergeo' ,
185
+ mode : 'text' ,
186
+ text : name . replace ( ' ' , '<br>' ) ,
187
+ locationmode : locationmode ,
188
+ locations : locations ,
189
+ hoverinfo : 'skip'
190
+ } ) ;
191
+
192
+ layout [ geo ] = {
193
+ domain : {
194
+ row : row ,
195
+ column : col ,
196
+ } ,
197
+ projection : { type : name } ,
198
+ fitbounds : 'locations'
199
+ } ;
200
+ }
201
+ }
202
+
203
+ console . log ( JSON . stringify ( {
204
+ data : data ,
205
+ layout : layout
206
+ } , null , 2 ) ) ;
207
+
129
208
// name of the axes
130
209
exports . axesNames = [ 'lonaxis' , 'lataxis' ] ;
131
210
Original file line number Diff line number Diff line change 429
429
"hovertemplate" : " albers usa"
430
430
},
431
431
{
432
- "name" : " albers usa" ,
433
432
"geo" : " geo19" ,
434
433
"type" : " scattergeo" ,
434
+ "mode" : " text" ,
435
+ "text" : " albers<br>usa" ,
435
436
"locationmode" : " USA-states" ,
436
437
"locations" : [
437
438
" WA"
438
439
],
439
- "mode" : " text" ,
440
- "text" : " albers<br>usa" ,
441
440
"hoverinfo" : " skip"
442
441
},
443
442
{
726
725
"projection" : {
727
726
"type" : " albers usa"
728
727
},
729
- "fitbounds" : " locations" ,
730
- "scope" : " usa"
728
+ "fitbounds" : " locations"
731
729
},
732
730
"geo20" : {
733
731
"domain" : {
You can’t perform that action at this time.
0 commit comments