HighChart Tooltip 不同的后缀值
HighChart Tooltip different suffix values
你好,我要在 highchart(蜘蛛网图)中显示学生的排名。在 y 轴上,我必须为不同的等级添加不同的后缀值(即第 1、2、3、4、100)。谁能帮我解决这个问题。
提前致谢
您可以使用 formatter
工具提示功能:
Highcharts.chart('container', {
series: [{
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
}],
tooltip: {
formatter: function() {
switch (this.x) {
case 1:
return 1 + 'st'
case 2:
return 2 + 'nd'
case 3:
return 3 + 'rd'
default:
return this.x + 'th'
}
}
}
});
现场演示:http://jsfiddle.net/BlackLabel/g48mszj9/
API: https://api.highcharts.com/highcharts/tooltip.formatter
你好,我要在 highchart(蜘蛛网图)中显示学生的排名。在 y 轴上,我必须为不同的等级添加不同的后缀值(即第 1、2、3、4、100)。谁能帮我解决这个问题。
提前致谢
您可以使用 formatter
工具提示功能:
Highcharts.chart('container', {
series: [{
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
}],
tooltip: {
formatter: function() {
switch (this.x) {
case 1:
return 1 + 'st'
case 2:
return 2 + 'nd'
case 3:
return 3 + 'rd'
default:
return this.x + 'th'
}
}
}
});
现场演示:http://jsfiddle.net/BlackLabel/g48mszj9/
API: https://api.highcharts.com/highcharts/tooltip.formatter