显然很难让它工作,所以我已经像这样制作了我的工具提示格式化程序:
tooltip: {
formatter:function(a,b,c){
var s = '<b>'+ Highcharts.dateFormat('%A, %b %e, %Y', this.x) +'</b>';
$.each(this.points, function(i, point) {
var prev = jQuery.inArray(point.x, point.series.processedXData)-1;
if(prev>=0){
prev = point.series.points[prev];
var percent = (point.y - prev.y) *100 / point.y;
var positive = false;
if(percent>0){
positive = true;
percent='+'+percent;
}
else
percent = percent +'';
percent = percent.substring(0,percent.indexOf('.')+3)+'%';
if(positive)
percent = '<span style="color:#000000">'+percent+'</span>';
else
percent = '<span style="color:#FF0000">'+percent+'</span>';
s += '<br/>'+'<span style="color:'+point.series.color+'">'+point.series.name+'</span>: <b>'+point.y+'</b> ('+percent+')';
}
else{
s += '<br/>'+'<span style="color:'+point.series.color+'">'+point.series.name+'</span>: <b>'+point.y+'</b>';
}
});
return s;
},
enable:true
},
在行动:http:
//jsfiddle.net/techunter/PhW3t/55/
如果有人有更好/更快的想法,请分享。