我需要百分號顯示在我的Highcharts樣條曲線圖的數據標籤中。到目前爲止,每一次格式的重複:'{point}%'都會打破整個事情,無論我在哪裏寫。基本上,而不是數據標籤讀取「22」它應該讀「22%」。Highcharts樣條線中的數據標籤格式化
JSFiddle here。
Highcharts.chart('container', {
chart: {
type: 'spline'
},
title: {
text: 'Enrollment By Race & Ethnicity'
},
subtitle: {
text: ''
},
xAxis: {
categories: ['Fall 2012', 'Fall 2013', 'Fall 2014', 'Fall 2015', 'Fall 2016']
},
yAxis: {
title: {
text: 'Percentage'
},
labels: {
formatter: function() {
return this.value + '%';
}
}
},
tooltip: {
crosshairs: true,
shared: true
},
plotOptions: {
spline: {
dataLabels: {
enabled: true
},
marker: {
radius: 4,
lineColor: '#666666',
lineWidth: 1
}
}
},
series: [{
name: 'Hispanic/Latino Undergrads',
marker: {
symbol: 'square'
},
data: [22, 25, 28, 31, 33]
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
是的!完善!謝謝你們,那正是我所期待的。非常感激! – Katwood