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

Fix negative values #49

Closed camiteca closed 4 years ago

camiteca commented 6 years ago

The value is updated through the $watch on the value property. Having several properties watching over the value was causing the value to update with the old value and new value of the properties attached (different to 'value'). I've changed the $watch to only update the value, any other property should redraw the entire chart.

And I've also added a fallback to the "middle" value to 0, meaning that if the value is undefined, it won't be shown. This can happen if your value is binded after the chart is drawn (like when you wait for an ajax call to retrieve the data).

ashish-chopra commented 6 years ago

I will check back soon. Thanks @karlmtc for your contribution as always!