Javascript examples for highcharts:Chart Label
Display static Y axis labels from array when series data is null
<html> <head> <title>Highcharts Demo</title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script src="https://code.highcharts.com/highcharts.src.js"></script> <div id="container"></div> <script type="text/javascript"> var chart = Highcharts.chart('container', { chart: {/*from w w w. j ava 2s .c o m*/ events: { load: function() { var nonZeroPointPresent = false, series, yAxisOptions; // check if there're non zero points for (var i = 0; i < this.series.length; i++) { if (nonZeroPointPresent) { break; } if (this.series[i].points.find((p) => p.y)) { nonZeroPointPresent = true; } } // change the configuration of the axis if (nonZeroPointPresent) { yAxisOptions = { categories: null, min: null, max: null } } else { yAxisOptions = { categories: ['a', 'b'], min: 0, max: 1 } } this.yAxis[0].update(yAxisOptions); } } }, series: [{ data: [1, 2] }] }); </script> </body> </html>