【问题标题】:Highcharts Pie chart multi line labels overlappingHighcharts饼图多线标签重叠
【发布时间】:2013-05-23 09:43:14
【问题描述】:

我正在使用带有动态生成的数据和绘图名称的 highcharts。 (通常在 4 到 8 个数据点之间,但会有 2 个小数字。)

其中一些有点长,导致饼图很小,所以我设置绘图选项样式宽度以强制它们换行并跨越多行。

但是在我的一些图表上,标签重叠并且不知道如何修复它。

有人有什么想法吗?

http://jsfiddle.net/d600burton/TkPBq/

var chart = new Highcharts.Chart({
    chart: {
        renderTo: 'container',
        plotBackgroundColor: null,
        plotBorderWidth: 1,
        plotShadow: false
    },
    subtitle: {
        text: 'Drag the handle in the lower right to resize'
    },
    tooltip: {
        pointFormat: '{series.name}: <b>{point.percentage:.2f}%</b>'
    },
    plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            minSize: 1,
            dataLabels: {
                        style: {
                            width: '100px'
                        },                     
                enabled: true,
                color: '#000000',
                format: '<b>{point.name}</b>: {percentage:.2f} %'
            }
        }
    },
    series: [{
        type: 'pie',
        name: 'Browser share',
        data: [
            {name: "On Hire", y: 2884},
            {name: "Collection Note", y: 674},
            {name: "Off Hire Not Confirmed", y: 23},
            {name: "Goods In", y: 41}
        ]

    }]
});

【问题讨论】:

    标签: highcharts


    【解决方案1】:

    连接器和datalables是独立生成的,所以如果你设置小,连接器不会“移动”。换句话说,我建议考虑修改宽度。

    【讨论】:

    • 谢谢。我管理的最好的方法是更改​​饼图的起始角度并将小数字部分组合在一起,以便它们出现在布局更好的右侧。我还更改了数据标签的宽度以减少换行。这适用于英语,但当情节名称被翻译时..
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多