【发布时间】:2021-11-05 09:05:51
【问题描述】:
【问题讨论】:
-
你如何生成标签,或者它对于所有栏都是静态的?
-
它是从后端接收到的对象动态生成的,你的回答解决了我的问题,谢谢。
【问题讨论】:
label 有 formatter 选项:
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [
{
data: [120, 200, 150, 80, 70, 110, 130],
label: {
show: true,
position: 'top',
formatter: function(data){
return 'Bar #' + (data.dataIndex+1)
}
},
type: 'bar'
}
]
};
【讨论】: