javascript - Highcharts Tooltip At Column Chart - Stack Overflow

I am working on this example: When I hover to some color pie chart, i.e. blue the tooltip is Jane: 13 f

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
Add a ment  | 

2 Answers 2

Reset to default 5

You 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

相关推荐

  • javascript - Highcharts Tooltip At Column Chart - Stack Overflow

    I am working on this example: When I hover to some color pie chart, i.e. blue the tooltip is Jane: 13 f

    3天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信