kam*_*aci 2 javascript jquery highcharts
我正在研究此示例:http : //www.highcharts.com/demo/combo
当我将鼠标悬停在一些彩色饼图上时,即蓝色,工具提示是
Jane: 13 fruits
Run Code Online (Sandbox Code Playgroud)
但是,当我将鼠标悬停在第一栏(苹果上的蓝色栏)时,工具提示是:
Apples: 3
Run Code Online (Sandbox Code Playgroud)
它是简的苹果。因此,如何将其更改为:
Jane : 3 apples
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
PS:
在示例中使用的工具提示格式器是:
tooltip: {
formatter: function() {
var s;
if (this.point.name) { // the pie chart
s = ''+
this.point.name +': '+ this.y +' fruits';
} else {
s = ''+
this.x +': '+ this.y;
}
return s;
}
}
Run Code Online (Sandbox Code Playgroud)
您可以series使用获取数据this.series.someAttr。
因此,请执行以下操作:
formatter: function() {
var s;
if (this.point.name) { // the pie chart
s = this.point.name +' '+ this.y +' fruits';
} else {
s = this.series.name + ' : ' +
this.x +': '+ this.y;
}
return s;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5931 次 |
| 最近记录: |