简体   繁体   English

HighStock-在不使用rangeSelector的情况下将范围设置为过去2小时

[英]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. 我有一个HighStock图表,它可以显示前24小时的数据,默认情况下,我要从该数据中仅显示最近2小时的数据,并允许用户将其拖动回去,以查看更多信息。

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: 这是一个JS小提琴:

http://jsfiddle.net/wVMGQ/2/ 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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