当y值都为0时,highcharts.js将线推到图表底部

highcharts.js push line to the bottom of the charts when y values are all 0

本文关键字:底部 js highcharts 0时      更新时间:2023-09-26

当y轴的值都为0时,0线在图表的中间,这不是很好看。我想把0线推到图表的底部。我在这个帖子上尝试了解决方案,但没有工作

Highcharts:确保y轴0值位于图表底部

http://jsfiddle.net/tZayD/58/

$(function () {
        $('#container5').highcharts({
      chart: {
                    type: 'column'
                },
                xAxis: {
                    categories: ['mon','tue','wed','thu','fri','sat']       
                },
                yAxis: {
                    title: {text: ''},
                    min:0
                },
                series: [{
                    name: 'Total Appts',
                    data: [0,0,0,0,0,0]
                }, {
                    name: 'Confirmed',
                    data: [0,0,0,0,0,0]
                }, {
                    name: 'no-shows',
                    data: [0,0,0,0,0,0]
                }]
            });          
    })

要使0"yValue"显示在图表的底部,而不是浮动在图表空间的中间,还需要设置yAxis.max值。将其设置为您期望值范围内的任意值。

要删除网格线并只使用0"yValue"网格,可以将gridLineWidth设置为0。

样品:

        yAxis: {
            title: {text: ''},
            min:0,
            max: 10,
            gridLineWidth: 0
        },