HighChart Stacked Column 标签问题

HighChart Stacked Column label issue

我有一个图表,其中的值不均匀,即:第一个值为 1315,第二个值为 1,依此类推,显示图表时标签重叠。我已经在多个论坛中搜索过,但没有人遇到完全相同的问题。这里有一个fiddle可以看出问题:http://jsfiddle.net/6LutjLc3/

$(function () {
$('#container').highcharts({
    chart: {
        type: 'column'
    },
    title: {
        text: 'Stacked column chart'
    },
    xAxis: {
        categories: ['Issue']
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Total fruit consumption'
        },
        stackLabels: {
            enabled: true,
            style: {
                fontWeight: 'bold',
                color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
            }
        }
    },
    legend: {
        align: 'right',
        x: -30,
        verticalAlign: 'top',
        y: 25,
        floating: true,
        backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
        borderColor: '#CCC',
        borderWidth: 1,
        shadow: false
    },
    tooltip: {
        formatter: function () {
            return '<b>' + this.x + '</b><br/>' +
                this.series.name + ': ' + this.y + '<br/>' +
                'Total: ' + this.point.stackTotal;
        }
    },
    plotOptions: {
        column: {
            stacking: 'normal',
            dataLabels: {
                enabled: true,
                color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                style: {
                    textShadow: '0 0 3px black'
                }
            }
        }
    },
    series: [{
        name: 'John',
        data: [1235]
    }, {
        name: 'Toto',
        data: [2]
    }, {
        name: 'Matt',
        data: [1]
    }, {
        name: 'Jane',
        data: [72]
    }, {
        name: 'Joe',
        data: [3]
    }]
});

});

我需要编写的代码是为值 1 提供一个框,就像 highchart 中的任何其他示例一样,标签适合该框。

在此先感谢您的帮助!

如果您的客户要求使用这种样式的图表,您可以通过修改 dataLabel 设置来获得更好看的结果。将 overflow 设置为 false 并添加一个格式化程序函数,该函数仅 returns 一个值,如果它至少占当前总数的 7%(或任何最适合您的百分比)将有所帮助。请参阅以下内容:

dataLabels: {
    enabled: true,
    overflow: false,
    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
    style: {
        textShadow: '0 0 3px black'
    },
    formatter: function () {        
        if (this.percentage >= 7) return this.y;
    }
}

Fiddle 这里:http://jsfiddle.net/6LutjLc3/4/