zoukankan      html  css  js  c++  java
  • 【highstock】按时间(zoom)让它去访问服务器呢?

    $(function () {
    /**
    * Load new data depending on the selected min and max
    */
    function afterSetExtremes(e) {
    var chart = $('#container').highcharts();
    chart.showLoading('Loading data from server...');
    $.getJSON('http://www.highcharts.com/samples/data/from-sql.php?start=' + Math.round(e.min) +
    '&end=' + Math.round(e.max) + '&callback=?', function (data) {
    chart.series[0].setData(data);
    chart.hideLoading();
    });
    }
    // See source code from the JSONP handler at https://github.com/highslide-software/highcharts.com/blob/master/samples/data/from-sql.php
    $.getJSON('http://www.highcharts.com/samples/data/from-sql.php?callback=?', function (data) {
    // Add a null value for the end date
    data = [].concat(data, [[Date.UTC(2011, 9, 14, 19, 59), null, null, null, null]]);
    // create the chart
    $('#container').highcharts('StockChart', {
    chart : {
    type: 'candlestick',
    zoomType: 'x'
    },
    navigator : {
    adaptToUpdatedData: false,
    series : {
    data : data
    }
    },
    scrollbar: {
    liveRedraw: false
    },
    title: {
    text: 'AAPL history by the minute from 1998 to 2011'
    },
    subtitle: {
    text: 'Displaying 1.7 million data points in Highcharts Stock by async server loading'
    },
    rangeSelector : {
    buttons: [{
    type: 'hour',
    count: 1,
    text: '1h'
    }, {
    type: 'day',
    count: 1,
    text: '1d'
    }, {
    type: 'month',
    count: 1,
    text: '1m'
    }, {
    type: 'year',
    count: 1,
    text: '1y'
    }, {
    type: 'all',
    text: 'All'
    }],
    inputEnabled: false, // it supports only days
    selected : 4 // all
    },
    xAxis : {
    events : {
    afterSetExtremes : afterSetExtremes
    },
    minRange: 3600 * 1000 // one hour
    },
    yAxis: {
    floor: 0
    },
    series : [{
    data : data,
    dataGrouping: {
    enabled: false
    }
    }]
    });
    });
    });

  • 相关阅读:
    hdu_2224_The shortest path(dp)
    hdu_4824_Disk Schedule(dp)
    hdu_5680_zxa and set(想法题)
    hdu_5683_zxa and xor(非正解的暴力)
    hdu_1429_胜利大逃亡(续)(BFS状压)
    hdu_1254_推箱子(双BFS)
    hdu_1969_pie(二分)
    hdu_2446_Shell Pyramid(数学,二分)
    hdu_2141_Can you find it?(二分)
    5.2 nc + JMX查看分布式程序数据
  • 原文地址:https://www.cnblogs.com/onetwo/p/6145432.html
Copyright © 2011-2022 走看看