Hide axis and gridlines Highcharts

2019-01-17 02:31发布

I am trying to hide the axis and gridlines of my Highcharts chart entirely. So far I have tried to set the width of the lines to 0, but it didn't work out.

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

Is it possible to just globally disable the axis lines/ticks and gridlines to create a "plain" plot?

7条回答
The star\"
2楼-- · 2019-01-17 02:38

Just add

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

to the xAxis definition.

查看更多
祖国的老花朵
3楼-- · 2019-01-17 02:40

This has always worked well for me:

yAxes: [{
         ticks: {
                 display: false;
                },
查看更多
聊天终结者
4楼-- · 2019-01-17 02:42

i managed to turn off mine with just

       lineColor: 'transparent',
       tickLength: 0
查看更多
祖国的老花朵
5楼-- · 2019-01-17 02:47

you can also hide the gridline on yAxis as:

yAxis:{ 
  gridLineWidth: 0,
  minorGridLineWidth: 0
}
查看更多
劫难
6楼-- · 2019-01-17 02:57

For the yAxis you'll also need:

gridLineColor: 'transparent',

查看更多
地球回转人心会变
7楼-- · 2019-01-17 03:02

If you have bigger version than v4.9 of Highcharts you can use visible: false in the xAxis and yAxis settings.

Example:

$('#container').highcharts({

    chart: {
        type: 'column'
    },

    title: {
        text: 'Highcharts axis visibility'
    },

    xAxis: {
        visible: false
    },

    yAxis: {
        title: {
            text: 'Fruit'
        },
        visible: false
    }

});
查看更多
登录 后发表回答