palerdot / react-d3-speedometer

React Speedometer component using d3.js ⚛️
https://palerdot.in/react-d3-speedometer/
MIT License
230 stars 57 forks source link

Minus sign used in "segmentValueFormatter" is wrong #172

Closed Robin-Hoodie closed 1 year ago

Robin-Hoodie commented 1 year ago

When using the option segmentValueFormatter, the value that is passed to the function is a string. If the original value is a negative number, the string that is passed will contain "−" (charcode 8722) instead of "-" (charcode 45).

This makes conversion of the number string back to a number result in NaN using Number / parseInt / parseFloat

palerdot commented 1 year ago

The library does not manually specify any particular character codes for negative numbers. Please share a reproducible repo/sandbox to illustrate the problem you are referring to.

Robin-Hoodie commented 1 year ago

Oddly enough I can't reproduce this in a sandbox, even when passing the exact same props as I do in my application. It must thus be something in my application that is doing this.

Closing this, apologies