Skip to content

Commit

Permalink
Load choropleth layer correctly (#82628)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck authored Nov 4, 2020
1 parent 2cd846b commit 0cfcf9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/plugins/region_map/public/choropleth_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ CORS configuration of the server permits requests from the Kibana application on
showAllData,
meta,
layerConfig,
serviceSettings
serviceSettings,
leaflet
) {
const clonedLayer = new ChoroplethLayer(
name,
Expand All @@ -295,7 +296,8 @@ CORS configuration of the server permits requests from the Kibana application on
showAllData,
meta,
layerConfig,
serviceSettings
serviceSettings,
leaflet
);
clonedLayer.setJoinField(this._joinField);
clonedLayer.setColorRamp(this._colorRamp);
Expand Down
16 changes: 9 additions & 7 deletions src/plugins/region_map/public/region_map_visualization.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,27 +170,29 @@ export function createRegionMapVisualization({
}

async _recreateChoroplethLayer(name, attribution, showAllData) {
const selectedLayer = await this._loadConfig(this._params.selectedLayer);
this._kibanaMap.removeLayer(this._choroplethLayer);

if (this._choroplethLayer) {
this._choroplethLayer = this._choroplethLayer.cloneChoroplethLayerForNewData(
name,
attribution,
this._params.selectedLayer.format,
selectedLayer.format,
showAllData,
this._params.selectedLayer.meta,
this._params.selectedLayer,
await getServiceSettings()
selectedLayer.meta,
selectedLayer,
await getServiceSettings(),
(await lazyLoadMapsLegacyModules()).L
);
} else {
const { ChoroplethLayer } = await import('./choropleth_layer');
this._choroplethLayer = new ChoroplethLayer(
name,
attribution,
this._params.selectedLayer.format,
selectedLayer.format,
showAllData,
this._params.selectedLayer.meta,
this._params.selectedLayer,
selectedLayer.meta,
selectedLayer,
await getServiceSettings(),
(await lazyLoadMapsLegacyModules()).L
);
Expand Down

0 comments on commit 0cfcf9f

Please sign in to comment.