Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load choropleth layer correctly #82628

Merged
merged 2 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
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