0

我的代码在这里

$(function () {
    $('#container').highcharts({
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false
        },
        title: {
            text: 'Browser market shares at a specific website, 2010'
        },
        tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    format: '<b>{point.name}</b>: {point.percentage:.1f} %'
                }
            }
        },
        series: [{
            type: 'pie',
            name: 'Browser share',
            data: [
                 {
                name: 'Chrome',
                y: 12.8,
                sliced: true,
                selected: true
            },
             {
                name: 'FireFox',
                y: 15.8
                                }
            ]
        }]
    });
});

在工具提示中

tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        }

我想写

tooltip: {
            pointFormat: '{series.data.name}: <b>{point.percentage:.1f}%</b>'
        }

它不工作请有人帮助我

我正在关注这个链接

http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/pie-basic/

4

2 回答 2

1

试试这个point.name应该有帮助

演示

 tooltip: {
        pointFormat: '<b>{point.name}</b>: <b>{point.percentage:.1f}%</b>'
 },
于 2013-11-14T12:45:43.730 回答
0

我建议您使用格式化程序,它允许自定义内容。自定义参数将保存在 point.options.name

http://api.highcharts.com/highcharts#tooltip.formatter

于 2013-11-14T12:44:39.697 回答