jquery - Highcharts 饼图数据标签内部和外部

标签 jquery highcharts pie-chart

我想要一个饼图,饼图内部和外部都有数据标签。 我知道,负距离会显示饼内的标签。但我想要它的内部和外部。 外面我想显示百分比,里面显示点的总和。

最佳答案

有一个简单的工作环境

那就是用不同的数据标签覆盖 2 个饼图

http://jsfiddle.net/4RKF4/29/

    $(function () {


        // Create the chart
        $('#container').highcharts({
            chart: {
                type: 'pie',
                backgroundColor: 'rgba(0,0,0,0)',
                y:100

            },
            title: {
                text: 'sfs '
            },
            yAxis: {
                title: {
                    text: ' '
                }
            },
            plotOptions: {
                pie: {
//                   y:1,
                    shadow: false,
//                  center: ['50%', '50%'],
                    borderWidth: 0,
                    showInLegend: false,
                    size: '80%',
                    innerSize: '60%'
                  ,

                    data: [
                        ['allo', 18],
                        ['asdad', 14],
                        ['asdad', 11],
                        ['asdasd', 10],
                        ['adad', 8],
                        ['asdada', 7],
                        ['adada ada', 7],
                        ['adad', 5],
                        ['asdas',7],
                        ['ada', 3]

                    ]
                }
            },
            tooltip: {
                valueSuffix: '%'
            },
            series: [
                {
                    type: 'pie',
                    name: 'Browser share',

                    dataLabels: {
                        color:'white',
                        distance: -20,
                        formatter: function () {
                            if(this.percentage!=0)  return Math.round(this.percentage)  + '%';

                        }
                    }
                },
                {
                    type: 'pie',
                    name: 'Browser share',

                    dataLabels: {
                        connectorColor: 'grey',
                        color:'black',
 //                            y:-10,
                        softConnector: false,
                        connectorWidth:1,
                        verticalAlign:'top',
                        distance: 20,
                        formatter: function () {
                            if(this.percentage!=0)  return this.point.name;

                        }
                    }
                }
            ]
        });
    });

关于jquery - Highcharts 饼图数据标签内部和外部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13488813/

相关文章:

javascript - highcharts动态使用插件grouped_categories

javascript - 删除仅包含一种类别的 Highcharts 中轴和列之间的空格

r - 带有ggplot2的多面饼图

javascript - HTML 对象与 jQuery 对象

JQuery UI 调整大小句柄不正确

jquery - 使 dataLabel 可拖动

javascript - D3.js 饼图色阶

python - 在 matplotlib 的饼图上组织文本

javascript - jQuery Flot 折线图,x 轴为月份、年份

javascript - jQuery 无法在 Ajax 上加载