/
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.
https://jsfiddle/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.
Share Improve this question edited Mar 12, 2016 at 18:01 martynasma 8,5952 gold badges32 silver badges47 bronze badges asked Mar 10, 2016 at 21:24 dingdingdingdingdingding 1,5813 gold badges15 silver badges27 bronze badges 1- Maybe: enter link description here – Dayane RS Commented Mar 11, 2016 at 1:25
1 Answer
Reset to default 10It'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.