1

我在 Highcharts 的甜甜圈中对馅饼大惊小怪,我似乎无法获得图例或共享工具提示。它适用于非共享工具提示

tooltip: {
            formatter: function () {
                return this.point.name + ': ' +this.y 
                    + ' units (' + Highcharts.numberFormat(this.percentage, 0) + '%)'
                ;  

            },
        },

但是,如果我尝试将其转换为共享的 tooltip,则什么也不会出现。

    tooltip: {
        formatter: function () {
            var s = this.series.name + this.point.name;
            $.each(this.points, function (i, point) {
                s += point.name + ' ' + point.y + ' ' + point.percentage;
            });
            return s;
        },
        shared: true
    },

我无法弄清楚我做错了什么。

4

1 回答 1

1

刚刚在您的格式化程序函数中查看了您的highcharts( ) 对象。this不确定您要完成什么,但看起来该highcharts对象包含一个series数组points

$.each(this.series.points, function (i, point) {
    s += point.name + ' ' + point.y + ' ' + point.percentage + '<br/>';
});

小提琴

编辑:为良好的测量添加了换行符 =D

于 2013-05-20T01:22:31.820 回答