可以使用Highcharts中的dataLabels属性调整饼图数据标签的位置,具体方法如下:
1.设置数据标签的position属性为“outside”,表示标签位于饼图外侧。
2.设置标签的distance属性表示标签与饼图的距离,数值越大距离越远。
代码示例:
Highcharts.chart('container', { // 饼图配置项 series: [{ type: 'pie', name: 'Sample data', data: [ ['Firefox', 45.0], ['IE', 26.8], ['Chrome', 12.8], ['Safari', 8.5], ['Opera', 6.2], ['Others', 0.7] ], dataLabels: { enabled: true, distance: 30, //调整标签距离 format: '{point.name}: {point.percentage:.1f} %', style: { color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black' }, connectorWidth: 1, connectorColor: 'silver' } }] });
上一篇:饼图扇形不匹配百分比
下一篇:饼图数据标签的定位问题