Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts blank chart with x and y axis

I want to use highcharts creating a blank chart with no datas but x and y axis. How to do it?

var chart = new Highcharts.Chart({

    chart: {
        renderTo: 'container'
    },

    yAxis: {        
        labels: {
            formatter: function() {
                return this.value +' km';
            }
        }
    },

    series: [{
        data: []        
    }]

});

it returns

enter image description here

But I want to display y-axis with label.

like image 230
Kevin Avatar asked Jan 14 '23 12:01

Kevin


1 Answers

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]
}
like image 90
Duniyadnd Avatar answered Jan 22 '23 03:01

Duniyadnd