Billboard.js的每个数据系列自定义标签
是否可以在Billboard.js中为每个数据系列应用自定义标签?与使用该系列中数据点的值,ID或索引相反?
我一直在使用以下Billboard.js文档进行参考: https://naver.github.io/billboard.js/release/release/latest/doc/doc/options.html#.data%25e2%2580%2580%25a4labels
https://naver.github.io/billboard.js/demo/#data.datalabelformat“ rel =“ nofollow noreferrer”> https://naver.github.github.io/billboard.js/demo/demo/demo/#datalabelformat
data: {
labels: true,
// or set specific options
labels: {
format: function(v, id, i, j) {
...
// to multiline, return with '\n' character
return "Line1\nLine2";
},
// it's possible to set for each data
format: {
data1: function(v, id, i, texts) { ... },
...
},
}
}
在上面的片段中,文本
被描述为“整个相应数据系列的文本标签的数组”。但是参数似乎是空的,我不确定如何传递文本标签。例如,我正在处理包括城市,国家的数据。是否可以让传奇/瓷砖=城市和标签=乡村。
Is it possible to apply a custom label for each data series in billboard.js? As opposed to using the value, id, or index of the data point in the series?
I've been using the following billboard.js documentation for reference: https://naver.github.io/billboard.js/release/latest/doc/Options.html#.data%25E2%2580%25A4labels
https://naver.github.io/billboard.js/demo/#Data.DataLabelFormat
data: {
labels: true,
// or set specific options
labels: {
format: function(v, id, i, j) {
...
// to multiline, return with '\n' character
return "Line1\nLine2";
},
// it's possible to set for each data
format: {
data1: function(v, id, i, texts) { ... },
...
},
}
}
In the above snippet, texts
is described as "the array of whole corresponding data series' text labels". But the parameter seems empty and I'm not sure how to pass in an array of text labels. For example, I'm working with data that includes a city, Country. Would it be possible to have the legend/tile = city and the label = country.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题帮助我解决了自己的问题。这就是我的方式:
Your question helped me to deal with my own problem. Here is how I went about it: