antoniolago / react-gauge-component

React gauge component for data visualization.
https://antoniolago.github.io/react-gauge-component/
MIT License
132 stars 19 forks source link

Marks values are rounded up #18

Closed simonapostolovski closed 1 year ago

simonapostolovski commented 1 year ago

Hi, so I'm adding my marks and subArcs values dynamically, basically some math is done to create one default mark as a value and then split the range equally to create at least 3 equal zones.

Marks:

image

subArcs:

image

Im working with values up to 1 so im multiplying all of them * 100.

And this is what i get:

image

Check the zones, the 3 zones after 0.2 should be equal, but the gap is 0.3, 0.2, 0.3 and its not split evenly.

My issue is that the values are rounded to the nearest. Its suppost to be 0.46 but its 0.5 mark, 0.73 but its 0.7, and its messing up the equal zones.

Any way the value rounding can be skipped? I checked the value format function but it doesn't work on this.

antoniolago commented 1 year ago

Hello, sorry for the late response. I added a maxDecimalDigits property to both marks labels and value label. This should enable you to avoid the rounding by increasing the decimal digits.

please try the new version 1.1.11 and let me know if this works for u

Also, remember you can use showMark property directly in your subArcs to use the limits as marks so you don't have to repeat the same values in the marks list