简体   繁体   中英

HighStock - Set the range to past 2hrs without using the rangeSelector

I have a HighStock chart that renders data for the previous 24hrs, from that data I want to by default only show the last 2hrs and allow the user to drag it back if they want to see more.

I know there are defaults that can be used with the Range Selector options though I dont want this rendered on the page. An option would be to hide this also.

Here is a JS fiddle:

http://jsfiddle.net/wVMGQ/2/

    $(function() {

    $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
        // Create the chart
        $('#chart').highcharts('StockChart', {


            rangeSelector : {
                //selected : 1,
                enabled: false
            },

            title : {
                text : 'AAPL Stock Price'
            },

            series : [{
                name : 'AAPL',
                data : data,
                tooltip: {
                    valueDecimals: 2
                }
            }]
        });
    });

});

Thanks Dave

您始终可以为xAxis设置minmax

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM