highcharts,3d饼图,通过distance设置负值,让标签放到饼图上出现问题。

时间:2023-01-21 23:35:24
highcharts,3d饼图,通过distance设置负值,让标签放到饼图上出现问题。
源码:
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
            options3d: {
                enabled: true,
                alpha: 45,
                beta: 0
            }
        },
        title: {
            text: '<label style="font-size:14px;font-weight: bold">年度投资额完成情况</label>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                size: 170,//饼的大小控制
                //innerSize : '20', //饼状图的内径大小,也可以配置为20%的百分比形式
                depth: 35,//深度
                colors:[
                 '#99CC66',
                 '#0066CC',
                 '#FF6666',
                 '#009966',
                 '#FF6600'
                ],
                showInLegend: true,//显示图例
                dataLabels: {
                    enabled: true,
                     distance:-15,//数据标签距离饼图边缘的距离,为负数就越靠近饼图圆心
                    format: '{point.percentage:.1f} %',
                    style: {
                        color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || '#000000'
                    }
                }
            }
        },
        legend: {                 
         layout: 'vertical',//图例布局,垂直排列                 
         align: 'right', //图例水平位置,左对齐           
         verticalAlign: 'top', //图例框的垂直对齐方式:顶端对齐              
         x: 5,                 
         y: 70,                 
         useHTML:true            
        }, 
        tooltip: {
         enabled: true,
            pointFormat: '<b>{point.y}</b>'
        },
        series: [{
            type: 'pie',
            name: '已实施项目区域分布情况',
            data: [
                ['高速', 388],
                ['城市', 119],
                ['城综', 109],
                ['轨道', 28],
                ['港口', 16]
    ]
}]
     });

效果图出现字重叠,并且文字出现偏移,求大神解答,并附着解决办法,谢谢。

2 个解决方案

#1


我也遇到这个问题,楼主解决了吗?

#2


楼主解决没有呢~~~~~

#1


我也遇到这个问题,楼主解决了吗?

#2


楼主解决没有呢~~~~~