https://jsfiddle.net/f3zy3bjc/
I'm trying to add a custom label to the end of each bar in a chart, like so:
"graphs": [{
"balloonText": "<b>[[category]]: [[value]]</b>",
"fillColorsField": "color",
"fillAlphas": 0.9,
"lineAlpha": 0.2,
"type": "column",
"valueField": "visits",
"labelFunction": function(data) {return 'new label';}
}],
The labelFunction property isn't working and I'm not sure why.
It's a good question. The reason why it doesn't work is that labelFunction
does not event get invoked if there are not label, and there are no label if labelText
is not set.
So, as awkward as it may sound, you need to define labelText
as well. You can set it to anything, it just need to produce a non-empty string.
"graphs": [{
"balloonText": "<b>[[category]]: [[value]]</b>",
"fillColorsField": "color",
"fillAlphas": 0.9,
"lineAlpha": 0.2,
"type": "column",
"valueField": "visits",
"labelText": " ",
"labelFunction": function(data) {return 'new label';}
}],
Updated fiddle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With