10000 More consistent geo maps configs by etpinard · Pull Request #4 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
grab topojson from PlotlyGeoAssets.topojson
  • Loading branch information
etpinard committed Nov 15, 2015
commit 9afb0148dd343af0b52eb47e75eb57131daa86d5
6 changes: 3 additions & 3 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,10 @@ function plotGeo(gd) {

var i, geoId, fullGeoData, geo;

// if plotlyjs-geo-assets-bundle is not included,
// initialize object to keep reference to every loaded topojsons
// if 'plotly-geo-assets.js' is not included,
// initialize object to keep reference to every loaded topojson
if(window.PlotlyGeoAssets === undefined) {
window.PlotlyGeoAssets = { topojsons : {} };
window.PlotlyGeoAssets = { topojson : {} };
}

for (i = 0; i < geoIds.length; i++) {
Expand Down
6 changes: 3 additions & 3 deletions src/plots/geo/geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ proto.plot = function(geoData, fullLayout) {
if(_this.topojson===null || topojsonNameNew!==_this.topojsonName) {
_this.topojsonName = topojsonNameNew;

if(PlotlyGeoAssets.topojsons[_this.topojsonName] !== undefined) {
_this.topojson = PlotlyGeoAssets.topojsons[_this.topojsonName];
if(PlotlyGeoAssets.topojson[_this.topojsonName] !== undefined) {
_this.topojson = PlotlyGeoAssets.topojson[_this.topojsonName];
_this.onceTopojsonIsLoaded(geoData, geoLayout);
}
else {
Expand All @@ -94,7 +94,7 @@ proto.plot = function(geoData, fullLayout) {
// N.B this is async
d3.json(topojsonPath, function(error, topojson) {
_this.topojson = topojson;
PlotlyGeoAssets.topojsons[_this.topojsonName] = topojson;
PlotlyGeoAssets.topojson[_this.topojsonName] = topojson;
_this.onceTopojsonIsLoaded(geoData, geoLayout);
});
}
Expand Down
0