I am working on this example:
When I hover to some color pie chart, i.e. blue the tooltip is
Jane: 13 fruits
However when I hover to first colum (blue one at apples) tooltip is:
Apples: 3
Its Jane's apples. So how can I change it to:
Jane : 3 apples
Any ideas?
PS:
The tooltip formatter used at example is:
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;
}
}
I am working on this example: http://www.highcharts./demo/bo
When I hover to some color pie chart, i.e. blue the tooltip is
Jane: 13 fruits
However when I hover to first colum (blue one at apples) tooltip is:
Apples: 3
Its Jane's apples. So how can I change it to:
Jane : 3 apples
Any ideas?
PS:
The tooltip formatter used at example is:
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;
}
}
Share
Improve this question
asked Sep 3, 2012 at 23:37
kamacikamaci
75.4k73 gold badges245 silver badges372 bronze badges
2 Answers
Reset to default 5You can get the series
data using this.series.someAttr
.
So, do the following:
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;
}
demo
Try this:
tooltip: {
formatter: function() {
var s;
if (this.point.name) { // the pie chart
s = ''+
this.point.name +': '+ this.y +' fruits';
} else {
s = ''+
this.series.name +': '+ this.y+' '+this.x;
}
return s;
}
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744750085a4591542.html
评论列表(0条)