Demo of setExtremes problem

author(s): Steve MItchell

by Riccal

HTML

<script src="http://github.highcharts.com/master/highcharts.js"></script>
<div id="container" style="height: 400px; width: 500px"></div>
<button id="button">Set extremes</button>

JavaScript

$(function () {
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container'
        },

        xAxis: {
            type: 'datetime',
            tickInterval: 48 * 3600 * 1000
        },

        series: [{
            data: [
                [Date.UTC(2013, 1, 13), 2], //outside the range
                [Date.UTC(2013, 1, 20), 3], //inside the range 
                [Date.UTC(2013, 1, 25), 2.5], //outside the range 
                [Date.UTC(2013, 2, 1), 2]
            ],
        }]
    });


    // the button action
    $('#button').click(function () {
        chart.xAxis[0].setExtremes(Date.UTC(2013, 1, 14), Date.UTC(2013, 1, 24), true, true);
    });
});