yanivam / react-svg-worldmap

A simple, compact and free React SVG world map.
MIT License
119 stars 43 forks source link

fix: make opacity correctly calculated with only one country value #109

Closed michelgotta closed 2 years ago

michelgotta commented 2 years ago

When passing only one country in the data array, the calculation for the opacity fails.

That is because maxValue - minValue will result in 0 and we divide by zero which result in Infinity / 'NaN'. Therefore the "fillOpacity" will not get a value which results in fillOpacity: 1, which is different from the 0.2 + 0.6 * ... which can only result in max 0.8 for fillOpacity.

Don't know if the suggested change is the best way to solve this, I just want to point that out.

Josh-Cena commented 2 years ago

Thanks! Good catch 👍