VictorCazanave / react-svg-map

A set of React.js components to display an interactive SVG map
https://victorcazanave.github.io/react-svg-map/
MIT License
229 stars 48 forks source link

Control path opacity #59

Open francescocretti opened 2 years ago

francescocretti commented 2 years ago

Hi, thanks for the useful tool!

I'm wondering if there's an handy way to control the opacity of a map region (so an SVG path).

I'm building an heatmap with an opacity scale based on data incoming from an API, so is not really possible to do that as in the Heatmap example.

Or rather, it's not possible without defining a CSS class for each possible opacity value, that's not something I really wanna do :)

Any suggestions?

Thanks a lot

VictorCazanave commented 1 year ago

Hi, It's currently not possible (without defining a CSS class for each possible opacity value), but I think adding the feature to set the style attribute of each location (with a new locationStyle prop for example) would solve your problem. I'll try to work on it in the following weeks, or feel free to create a pull request!