highchart datalabel标签中缺少一个值

时间:2015-09-25 05:47:20

标签: angularjs highcharts

我有类似于粘贴小提琴链接的高图图形api,问题
    是少数堆叠列中的数字丢失(例如小提琴 decission 第一行标签值丢失)任何人都可以帮助解决这个问题     这种情况正在发生

$(function () {
$('#container').highcharts({
    chart: {
        type: 'column',
        inverted:true,
        height: 200
    },
    title: {
        text: 'Stacked column chart'
    },
    xAxis: {
        categories: ['Pending', 'Further', 'Decision']
    },
    yAxis: {
        min: 0,
        //max:100,
        title: {
            text: 'Total fruit consumption'
        },
        stackLabels: {
            enabled: true,
            style: {
                fontWeight: 'bold',
                color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
            }
        }
    },
    legend: {
        align: 'center',
        x: -30,
        verticalAlign: 'top',
        y: 25,
        floating: false,
        backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
        borderColor: '#CCC',
        borderWidth: 1,
        shadow: false
    },
    tooltip: {
        headerFormat: '<b>{point.x}</b><br/>',
        pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
    },
    plotOptions: {
        column: {
            stacking: 'normal',
            dataLabels: {
                enabled: true,
                crop:false,
                color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                style: {
                    textShadow: '0 0 3px black'
                }
            }
        }
    },
    series: [{
        data:[3, 2, 1], 
        name:'Today'
    }, {
        data:[2, 2, 19], 
        name:'1 Day'
    }, {
        data:[14, 2, 22], 
        name:'2 Days'
    },{
        data:[6, 2, 18], 
        name:'3 Days'
    },{
        data:[10, 2, 537], 
        name:'>3 Days'
    }]
});

}); http://jsfiddle.net/g6wsd1hm/

1 个答案:

答案 0 :(得分:0)

如果我将堆叠更改为百分比,则所有标签都可见。 minPointLength设置为使相对较少的数字

的最小列堆栈宽度

使用以下内容:

 plotOptions: {
        column: {
            stacking: 'percent',
            minPointLength:10 //this needs to added
                }
              }

小提琴Here