在饼图中添加额外的数据。我已经尝试过这种方式但没有工作。该值未显示在工具提示中。那么是否可以在工具提示中添加其他数据?
chartData=[{"name": "apples", "y": 20,"additionalData": 33$},
{"name": "oranges", "y": 40,"additionalData": 20$},
{ “名称”:“香蕉”,“y”:50,“附加数据”:10$}]
Highcharts.chart('chartContainer', {
chart: {
// Edit chart spacing
spacingBottom: 15,
spacingTop: 10,
spacingLeft: 0,
spacingRight: 10,
width: 600,
height: 350
},
title: {
text: ''
},
xAxis: {
title: {
text: null
}
},
yAxis: {
min: 0,
title: {
text: ''
},
labels: {
overflow: 'justify'
}
},
tooltip: {
pointFormat:'<b>{point.y}<b><br> Cost: <b>{point.additionalData} </b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
point:{
events : {
legendItemClick: function(e){
e.preventDefault();
}
}
},
showInLegend: true
},
},
credits: {
enabled: false
},
series: [{
colorByPoint: true,
type: 'pie',
data:this.chartData
}]
})
}