yanivam / react-svg-worldmap

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

Color Prop not working as expected with false-y values #126

Closed kennethbigler closed 2 years ago

kennethbigler commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

The color prop does not activate with value=0. My guess is you are doing something like "if value, apply color" but it should probably be more like "if value !== undefined, apply color".

As a feature request, I would love it if you could also update value to be either number | string.

To Reproduce Steps to reproduce the behavior:

pretty straightforward, give any country a value of 0 and the color will not display.

Expected behavior A clear and concise description of what you expected to happen.

pretty straightforward, give any country a value of 0 and the color should display. Give any country a value of undefined and the color should not display. If you want to get fancy, it probably makes sense to have undefined | null not display the color.

yanivam commented 2 years ago

This is fair but I am going to mark it as a feature request rather than a bug. When we originally designed the map, our intention was to make it so that any country with a value of 0 does not get color. Since I think this is a very valid request in my opinion, I would just mark it as a feature request rather than a bug. Thanks for the comment, I have been very busy and haven’t gotten a second to work on this. If my workload lightens next week I will take a look. Thanks for bearing with us. Yams

kennethbigler commented 2 years ago

Hey, thanks for the response! I love to see an active developer community. I may try to contribute it if I have some time this week too, but don't wait up for me!

kennethbigler commented 2 years ago

I couldn't get the build working locally but this is what I had in mind: https://github.com/yanivam/react-svg-worldmap/pull/127

Josh-Cena commented 2 years ago

This is actually a bug. Imagine if we have a map of GDP growth rates where there are both positive and negative values. Both positive and negative values would have colors, but only 0 would have no color. This is clearly not working as intended. Not all scales start at zero.