Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AmAngularGauge show labels for bands only

Is there a way to show the labels on Gauge chart only for bands' endValue? I saw the labelFrequency and valueInterval properties, but it's not helping.

like image 904
István Avatar asked Dec 05 '25 07:12

István


1 Answers

It is possible to pass a function into the labelFunction property. Using this with labelFrequency and valueInterval, it is possible to achieve what you want (demo) :

"valueInterval": 10,
"labelFrequency": 1,
"labelFunction" : function(value){
    if (value == 90 || value == 130 || value == 220){
        return value;
    } else {
        return "";
    }
},

However, I see two slight problems with this solution :

First, it is not possible to control the number of ticks on the axis anymore. This might become ugly, if you can't set an high value for the valueInterval.

Second, depending on how you decide the value for the beginning and the end of the gauge, this solution might require more work, like computing the GCD of the ranges (for valueInterval).

like image 178
Richard Avatar answered Dec 07 '25 05:12

Richard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!