【问题标题】:How can i use Highstock rangeSelector get the yAxis Max_value and Min_Value我如何使用 Highstock rangeSelector 获取 yAxis Max_value 和 Min_Value
【发布时间】:2015-08-17 20:41:59
【问题描述】:

如何使用 Highstock rangeSelector 获取 yAxis Max_value 和 Min_Value ??

http://jsfiddle.net/r2wm5dyj/

$(函数 () { $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=new-intraday.json&callback=?', 函数(数据){

    // create the chart
    $('#container').highcharts('StockChart', {


        title: {
            text: 'AAPL stock price by minute'
        },

        subtitle: {
            text: 'Using ordinal X axis'
        },

        xAxis: {
        events: {
            setExtremes: function(e) {

                $('#Sdate').html( Highcharts.dateFormat(null, e.min));
                $('#Edate').html( Highcharts.dateFormat(null, e.max));


            }
        }
    },

        rangeSelector : {
            buttons : [{
                type : 'hour',
                count : 1,
                text : '1h'
            }, {
                type : 'day',
                count : 1,
                text : '1D'
            }, {
                type : 'all',
                count : 1,
                text : 'All'
            }],
            selected : 1,
            inputEnabled :false
        },

        series : [{
            name : 'AAPL',
            type: 'area',
            data : data,
            gapSize: 8,
            tooltip: {
                valueDecimals: 1
            },
            fillColor : {
                linearGradient : {
                    x1: 0,
                    y1: 0,
                    x2: 0,
                    y2: 1
                },
                stops : [
                    [0, Highcharts.getOptions().colors[5]],
                    [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
                ]
            },
            threshold: null[enter link description here][1]
        }]
    });
});

});

【问题讨论】:

    标签: highstock


    【解决方案1】:

    我自己找到解决办法

      xAxis: {
            events: {
                setExtremes: function(e) {
    
                    $('#Sdate').html( Highcharts.dateFormat(null, e.min));
                    $('#Edate').html( Highcharts.dateFormat(null, e.max));
    
    
    
                },
                afterSetExtremes:function(e)
                {
                      var chart = $('#container').highcharts(),
                     extremes = chart.yAxis[0].getExtremes();
                       $('#HiestTemp').html(extremes.dataMax);
                      $('#LowestTime').html(extremes.dataMin);
    
    
                }
            }
        },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-30
      • 2021-05-08
      • 2020-03-16
      • 1970-01-01
      • 1970-01-01
      • 2020-02-15
      • 1970-01-01
      相关资源
      最近更新 更多