admin管理员组文章数量:1310493
/
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.
本文标签: javascriptamCharts LabelFunction not workingStack Overflow
版权声明:本文标题:javascript - amCharts LabelFunction not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741816712a2399118.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论