2
我想向工具提示中的工具提示添加评分,该评分取决于工具提示中的{point.y}。这是我的转换功能:Highchart:将自己的计算添加到工具提示
function getGrade(score)
{
if(score >= 5-4/6)
return 'A';
if(score >= 5-4/6*2)
return 'B';
if(score >= 5-4/6*3)
return 'C';
if(score >= 5-4/6*4)
return 'D';
if(score >= 5-4/6*5)
return 'E';
if(score >= 5-4/6*6)
return 'F';
}
这是我的highchart配置:
$(function() {
$('#container').highcharts({
chart: {
polar: true,
type: 'line'
},
title: {
text: 'Budget vs spending',
x: -80
},
pane: {
size: '80%'
},
xAxis: {
categories: ['Sales', 'Marketing', 'Development', 'Customer Support',
'Information Technology', 'Administration'],
tickmarkPlacement: 'on',
lineWidth: 0
},
yAxis: {
gridLineInterpolation: 'polygon',
lineWidth: 0,
min: 0
},
tooltip: {
shared: true,
pointFormat: '<span style="color:{series.color}">{series.name}: <b>' + getGrade('{point.y:,.0f}') + '</b> ({point.y:,.0f})<br/>'
},
legend: {
align: 'right',
verticalAlign: 'top',
y: 70,
layout: 'vertical'
},
series: [{
name: 'Allocated Budget',
data: [1, 1, 2, 3, 4, 5],
pointPlacement: 'on'
}, {
name: 'Actual Spending',
data: [3, 4, 3, 2, 2, 2],
pointPlacement: 'on'
}]
});
});
在这里,整个代码http://jsfiddle.net/A2uvs/
有谁一个什么问题?
在此先感谢!
这就是我需要的!谢谢! – Max
很高兴我能帮忙,谢谢! :) – t1nr2y