非常感謝@adelriosantiago,我添加了一個條件來檢查點或點屬性取決於s eries或派。 highcharts的最新版本(4.1.5)有問題,顯示嵌入式餡餅的提示,我只好用以前的版本(4.0.4)
formatter : function() {
var s = '<b>' + this.x + '</b>';
var color = null;
if (typeof this.points != 'undefined') {
$.each(this.points, function(i, point) {
color = point.series.color.stops[1][1];
if (i == 3) {
s += '<br/><span style="color:' + color + '">\u00A2</span> ';
s += point.series.name + ': ' + Highcharts.numberFormat(point.y, 2);
} else {
s += '<br/><span style="color:' + color + '">\u25CF</span> ';
s += point.series.name + ': ' + Highcharts.numberFormat(point.y, 0);
}
});
} else {
color = this.point.color.stops[1][1];
s = '<h3 style="color:' + color + '; font-weight: bold;">' + this.point.name + '</h3>';
s += '<br/><span style="color:' + color + '">\u25CF</span> ';
s += Highcharts.numberFormat(this.point.y, 2) + ' (' + Highcharts.numberFormat(this.point.percentage, 2) + '%)';
}
return s;
}
這裏全部修復http://jsfiddle.net/castocolina/2mdt9rhb/4/
謝謝@adelriosantiago,這是很好的解決方案,但是會產生Pie mouseover事件錯誤,可能是工具提示過程。 在鉻: _Uncaught類型錯誤:無法讀取undefined_ jQuery的1.9.1.js的屬性 '長度':622 在FF _TypeError:obj是undefined_ jquery的-1.9.1.js:622:3 痕量該錯誤是由高層圖產生的。 我嘗試與其他版本的jQuery和問題仍然存在。嘗試啓用工具提示餅圖,但沒有成功。我認爲要啓用標籤以上的情節。 – ccolina