Highcharts Demo

author(s): Torstein Hønsi

by HemalathaThanigaivel

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>

JavaScript

$(function () {
    $('#container').highcharts({
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
            minRange: 1,
            events: {
                afterSetExtremes: function () {
                console.log(this.max)
                    if (this.max < 8) {
                        this.chart.yAxis[0].setExtremes(null, 100);
                    } else {
                        this.chart.yAxis[0].setExtremes(null, 200);
                    }
                }
            }
        },

        yAxis: {
            max: 200
        },
        chart: {
            zoomType: 'x'
        },
        series: [{
            data: [29.9, 21.5, 20.4, 29.2, 14.0, 16.0, 15.6, 14.5, 26.4, 194.1, 95.6, 54.4]
        }]
    });
});