bernii / gauge.js

100% native and cool looking JavaScript gauge
MIT License
1.42k stars 391 forks source link

when the current value is 0 #25

Open webexpressor opened 11 years ago

webexpressor commented 11 years ago

when the current value is 0, the canvas render two pointer,however,there should be one.

webexpressor commented 11 years ago

this happen when set angle: 0.05 ,it default 0.15

PavelPolyakov commented 11 years ago

I have the same issue

mark-sch commented 11 years ago

Gauge has several default values, also this one: Gauge.prototype.displayedValue = 0

When the current value is set to 0, it has the side effect that options are not applied correctly. Quickfix is to set the internal default value Gauge.prototype.displayedValue = 1. Then the display is fine and the textfield is also initialized correctly.

I have commited this quickfix in my fork.

niftytushar commented 10 years ago

Here is a fiddle to illustrate the situation http://jsfiddle.net/niftytushar/vAnGE/1/ When the value of gauge is set to 0 initially, two pointers are rendered on the canvas. Also no text is displayed in the text field in this situation. However, when we set the value initially to 1 and then to 0 again, then everything works just as expected.

vvnc commented 6 years ago

This is the duplicate of #71 and seems to be fixed.