首页 文章

隐藏轴和网格线Highcharts

提问于
浏览
73

我试图完全隐藏我的Highcharts图表的轴和网格线 . 到目前为止,我已经尝试将行的宽度设置为0,但它没有成功 .

xAxis: {
  lineWidth: 0,
  minorGridLineWidth: 0,
  lineColor: 'transparent'
}

是否可以全局禁用轴线/刻度线和网格线以创建“普通”图?

7 回答

  • 133

    只需添加

    xAxis: {
       ...  
       lineWidth: 0,
       minorGridLineWidth: 0,
       lineColor: 'transparent',
       ...          
       labels: {
           enabled: false
       },
       minorTickLength: 0,
       tickLength: 0
    }
    

    到xAxis定义 .

  • 25

    对于 yAxis ,您还需要:

    gridLineColor: 'transparent',

  • 68

    如果您的版本高于Highcharts的v4.9,则可以在 xAxisyAxis 设置中使用 visible: false .

    例:

    $('#container').highcharts({
    
        chart: {
            type: 'column'
        },
    
        title: {
            text: 'Highcharts axis visibility'
        },
    
        xAxis: {
            visible: false
        },
    
        yAxis: {
            title: {
                text: 'Fruit'
            },
            visible: false
        }
    
    });
    
  • 19

    您还可以将yAxis上的网格线隐藏为:

    yAxis:{ 
      gridLineWidth: 0,
      minorGridLineWidth: 0
    }
    
  • 2

    我设法完全关闭我的

    lineColor: 'transparent',
           tickLength: 0
    
  • 5

    如果您不想触摸配置对象,则只需通过css隐藏网格:

    .chart-container .highcharts-grid {
       display: none;
    }
    
  • 0

    这对我来说一直很好:

    yAxes: [{
             ticks: {
                     display: false;
                    },
    

相关问题