ashish-chopra / angular-gauge

A reusable gauge directive for Angular 1.x apps and dashboards
https://ashish-chopra.github.io/angular-gauge/
MIT License
95 stars 36 forks source link

Zero value is not drawed correctly in some case #68

Open ghost opened 5 years ago

ghost commented 5 years ago

I use this library in a dashboard where i do polling to track data changes. When value of gauge is different from 0, it is updated correctly When value (during polling) is 0, the value printed inside gauge is correct, but the arch is not redrawed.

An example can be reproduced as is screens in your public website 1) first set value = 30 2) select and delete value (empty = 0) in gauge text value is correct, but arch remain as 30

Screenshot 2019-07-05 at 11 32 05 Screenshot 2019-07-05 at 11 32 12

Debugging I found that in animate function (row 137), middle is setted as: var middle = start + previousProgress + displacement * progress; when value pass from something to 0, displacement is = 0 so middle remain as before

to avoid it, I add this control before set middle if (displacement == 0) { displacement = - previousProgress; } so middle will change correctly