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