yAxis zooming in to area with unknown values - Javascript highcharts

Javascript examples for highcharts:Chart Axis

Description

yAxis zooming in to area with unknown values

Demo Code

ResultView the demo in separate window

<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.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <script src="https://code.highcharts.com/modules/export-data.js"></script> 
      <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> 
      <h2>Too see y axis dissapear zoom in to area with missing values</h2> 
      <script type="text/javascript">
Highcharts.chart('container', {
    chart: {//w w  w.  j av  a2s.  c  o  m
        type: 'line',
        spacingBottom: 30,
        zoomType: 'x',
    },
    title: {
        text: 'Fruit consumption *'
    },
    subtitle: {
        text: 'test test test test test consumption is unknown',
        floating: true,
        align: 'right',
        verticalAlign: 'bottom',
        y: 15
    },
    legend: {
        layout: 'vertical',
        align: 'left',
        verticalAlign: 'top',
        x: 100,
        y: 70,
        floating: true,
        borderWidth: 1,
        backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
    },
    xAxis: {
        categories: ['Apples', 'Pears', 'Oranges', 'Bananas', 'Grapes', 'Plums', 'Strawberries', 'Raspberries']
    },
    yAxis: {
        title: {
            text: 'Y-Axis'
        },
        labels: {
            formatter: function () {
                return this.value;
            }
        },
        max: 5, min: 0
    },
    tooltip: {
        formatter: function () {
            return '<b>' + this.series.name + '</b><br/>' +
                this.x + ': ' + this.y;
        }
    },
    plotOptions: {
        area: {
            fillOpacity: 0.5
        }
    },
    credits: {
        enabled: false
    },
    series: [{
        name: 'Jane',
        data: [1, 0, 3, null, null, null, null, null, null, null, null, null, 3, 1, 2, 1, 1, 0, 3, 1, 3, 1, 2, 1]
    }]
});

      </script>  
   </body>
</html>

Related Tutorials