Highchart堆积了酒吧yAxis被堆积的标签问题

时间:2018-05-29 18:54:31

标签: highcharts label stacked-chart

这是js fiddle highchart stacked bar stacked label issue

Highcharts.chart('container', {
    chart: {
        type: 'bar'
    },
    title: {
        text: 'Stacked bar chart'
    },
    xAxis: {
        categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Total fruit consumption'
        },
        stackLabels: {
          enabled: true,
          align: 'right',
          style: {
            color: '#838383',
            fontSize:"12px",
            fontWeight:"normal",
            width:'60px'
          }
        }
    },
    legend: {
        reversed: true
    },
    plotOptions: {
        series: {
            stacking: 'normal'
        }
    },
    series: [{
        name: 'John',
        data: [5555555555555, 3, 4, 7, 2]
    }, {
        name: 'Jane',
        data: [2, 2, 3, 2, 1]
    }, {
        name: 'Joe',
        data: [3, 4, 4, 2, 5]
    }]
}); 

是否有设置最大条形长度以便yAxis标签不隐藏?或者我如何显示完整的标签?如果它的价值很大,目前它会隐藏标签的某些部分。

1 个答案:

答案 0 :(得分:0)

您需要像这样设置align

    labels: {
        align:'right'
    }

Fiddle