score:3

Accepted answer

You can put data and hide the series after setting property

ignoreHiddenSeries : false

Here is Working Demo If you hide the series Y-Axis will still be visible.

score:0

FWIW, it seems that highcharts has this functionality built in yAxis.showEmpty

Unfortunately, the fiddle listed in the documentation doesn't work, and there is a related open highcharts issue on the matter:

no hide y axis

score:0

Setting min and max for xAxis and yAxis is not a good solution! Because if the data is loaded later (When it's resolved), then you won't have auto calculated min and max. In Highcharts API, it's said:

If null, the max value is automatically calculated

So you should set min and max back to null when the data is loaded. But in my case setting it to null or even deleting the option, didn't result in automatic calculating (Seems strange).

What I did instead was setting charts.showAxes to true! That's it. Take a look at the demo provided by Highcharts

Important: You of course need to set series to something like this:

series: [
  {
    data: [null, null, null]
  },
  {
    data: [null, null, null]
  }
]

Note: Make sure xAxis.showEmpty and yAxis.showEmpty are set true (which is true by default).

score:6

You can put in your min/max values for the xAxis and yAxis and use null for all data.

Forked from @ZaheerAhmed's response above as I figure it deserves a spot as an alternative solution without needing to hide the data after the fact.

i.e.

yAxis: {
   min: 1,
   max:
} ,
xAxis: {
   min: 1,
   max: 50
},
series: {
   data:[null,null]
}

Related Query

More Query from same tag