You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature request: is it possible to change the style after creating a layer? I'd like to show a map and then have a drop down of feature names, and then update the layer to colour by that feature, possibly with a different colour scale.
At present I don't think it can be easily done because the colour mapping info is stored in opts which has the scope of the L.choropleth constructor - changing mylayer.options and forcing a style update with mylayer.setStyle(mylayer.options.style) doesn't work. I can't actually see how a style function can get anything from the layer options, but my JS skills are poor, especially understanding scope in JS...
The text was updated successfully, but these errors were encountered:
Hi Barry, that's an interesting question. I'm not entirely sure. The Choropleth method just extends the GeoJSON method, so I think if you do some googling on how you would change a GeoJSON layer dynamically, you could apply that approach to this module as well.
Feature request: is it possible to change the style after creating a layer? I'd like to show a map and then have a drop down of feature names, and then update the layer to colour by that feature, possibly with a different colour scale.
At present I don't think it can be easily done because the colour mapping info is stored in
opts
which has the scope of the L.choropleth constructor - changing mylayer.options and forcing a style update with mylayer.setStyle(mylayer.options.style) doesn't work. I can't actually see how a style function can get anything from the layer options, but my JS skills are poor, especially understanding scope in JS...The text was updated successfully, but these errors were encountered: