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

Thresholds value is treated as string produces wrong color values #46

Closed ashish-chopra closed 6 years ago

ashish-chopra commented 6 years ago

The threshold value used a key is used a string in the algorithm to compare with each other, therefore always wrong color get selected due to string comparison, not number comparison. For example if this is the case:

$scope.gaugeThreshold = {
'0': {color: '#228B22'},
'8': {color: "#AABC22"},
'21': {color: '#FFF54C'},
'31': {color: '#DF9111'},
'41': {color: '#FF0000'}
};

The color related to 8 is always shown for anything >= 8.

ashish-chopra commented 6 years ago

Resolved. Thanks @donghopark for pull request.