Skip to content

Commit 3da8db5

Browse files
committed
create mock for various projection types
1 parent 0fc177b commit 3da8db5

File tree

3 files changed

+6385
-6
lines changed

3 files changed

+6385
-6
lines changed

src/plots/geo/constants.js

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ var layout = {
143143
},
144144
annotations: [{
145145
showarrow: false,
146-
text: 'fitbounds<br>\'locations\'<br>for all<br>projection<br>types',
146+
text: 'all<br>projection<br>types<br>in Plotly',
147147
font: { size: 20 },
148148
x: 1,
149149
xref: 'paper',
@@ -164,24 +164,36 @@ for(var col = 0; col < nCol; col++) {
164164
var geo = 'geo' + (n ? n + 1 : '');
165165
var usa = name.indexOf('usa') !== -1;
166166
var locationmode = usa ? 'USA-states' : undefined;
167-
var locations = usa ? ['WA'] : ['AUS'];
167+
var locations = usa ? ['TX', 'WA', 'NY', 'AK'] : ['GHA', 'ARG', 'AUS', 'CAN'];
168168

169169
data.push({
170170
name: name,
171171
geo: geo,
172172
type: 'choropleth',
173173
locationmode: locationmode,
174174
locations: locations,
175-
z: [10],
175+
z: [1, 2, 3, 4],
176176
showscale: false,
177177
hovertemplate: name
178178
});
179179

180+
data.push({
181+
geo: geo,
182+
type: 'scattergeo',
183+
mode: 'markers+text',
184+
text: ['Cape Town', 'Los Angeles'],
185+
textfont: { size: 6 },
186+
marker: { color: ['lightgreen', 'yellow'], size: [20, 10] },
187+
lat: [-34, 34],
188+
lon: [18, -118]
189+
});
190+
180191
data.push({
181192
geo: geo,
182193
type: 'scattergeo',
183194
mode: 'text',
184-
text: name.replace(' ', '<br>'),
195+
text: [name.replace(' ', '<br>')],
196+
textfont: { color: 'darkblue', family: 'Gravitas One, cursive' },
185197
locationmode: locationmode,
186198
locations: locations,
187199
hoverinfo: 'skip'
@@ -192,10 +204,24 @@ for(var col = 0; col < nCol; col++) {
192204
row: row,
193205
column: col,
194206
},
195-
showocean: usa ? false : true,
196207
projection: { type: name },
197-
fitbounds: 'locations'
208+
lonaxis: {
209+
showgrid: true,
210+
gridwidth: 1,
211+
gridcolor: 'lightgray'
212+
},
213+
lataxis: {
214+
showgrid: true,
215+
gridwidth: 1,
216+
gridcolor: 'lightgray'
217+
}
218+
// fitbounds: 'locations'
198219
};
220+
221+
if(!usa) {
222+
layout[geo].showcoastlines = false;
223+
layout[geo].showocean = true;
224+
}
199225
}
200226
}
201227

Loading

0 commit comments

Comments
 (0)