我有一个带有 Highcharts 的饼图
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
distance: -30
},
showInLegend: true
}
},
series: [{
name: 'Types',
colorByPoint: true,
data: [ {
name: 'Debtors',
y: 10.38
}, {
name: 'Suppliers',
y: 4.77
},
]
}]
当前饼图中标签中的数据名称(即:债务人、 vendor )就是饼图中显示的内容
我希望显示值,但图例应保留名称。
最佳答案
您需要启用该格式。
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
distance: -30,
format: '<b>{point.name}</b>: {point.y:,.2f}',
},
showInLegend: true
}
},
series: [{
name: 'Types',
colorByPoint: true,
data: [ {
name: 'Debtors',
y: 10.38
}, {
name: 'Suppliers',
y: 4.77
},
]
}]
Jsfiddle 演示:http://jsfiddle.net/powrcnf1/
关于javascript - Highcharts 标签显示值而不是名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45824522/