From 88cde7c3c0e0b9d1f272a2971c662ba4f06ecca3 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 4 Nov 2020 16:00:57 -0500 Subject: [PATCH] Load choropleth layer correctly (#82628) --- .../region_map/public/choropleth_layer.js | 6 ++++-- .../public/region_map_visualization.js | 16 +++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/plugins/region_map/public/choropleth_layer.js b/src/plugins/region_map/public/choropleth_layer.js index 14a91e189e0d5..62f4ffe9be677 100644 --- a/src/plugins/region_map/public/choropleth_layer.js +++ b/src/plugins/region_map/public/choropleth_layer.js @@ -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, @@ -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); diff --git a/src/plugins/region_map/public/region_map_visualization.js b/src/plugins/region_map/public/region_map_visualization.js index 9b20a35630c86..ecb3541827cb3 100644 --- a/src/plugins/region_map/public/region_map_visualization.js +++ b/src/plugins/region_map/public/region_map_visualization.js @@ -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 );