Highcharts将列坚持到x轴

问题描述 投票:0回答:1

为什么演示代码中的列位于x轴上方。如何使它们粘在x轴上。

https://jsfiddle.net/nmLo2sbu/

Highcharts.chart('container', {
    chart: {
         type: 'column'
    },
    title: {
        text: 'Stacked bar chart'
    },
    xAxis: {
        categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],

        lineColor: '#FF0000',
                offset:0,

    },
    yAxis: {
        title: {
            text: 'Total fruit consumption'
        },
    },

    plotOptions: {
        series: {
              minPointLength: 3,
           // stacking: 'normal'
        }
    },
    series: [{
        name: 'John',
        data: [0, 0, 0, 0, 0]
    }, {
        name: 'Jane',
        data: [0, 0, 0, 0, 0]
    }, {
        name: 'Joe',
        data: [0, 0, 0, 0, 0]
    }]
});
javascript highcharts
1个回答
0
投票

Highcharts无法计算yAxis的极值,因此刻度号0位于中间。另外,column系列的threshold的默认值为0。例如,可以使用softMax属性强制计算极值。

yAxis: {
  ...,
  softMax: 1
}

实时演示: https://jsfiddle.net/BlackLabel/08ohe6m3/

API参考:

https://api.highcharts.com/highcharts/series.column.threshold

https://api.highcharts.com/highcharts/yAxis.softMax

© www.soinside.com 2019 - 2024. All rights reserved.