【问题标题】:How can I get the navigator selection from a Highstock chart?如何从 Highstock 图表中获得导航器选择?
【发布时间】:2012-08-15 10:44:25
【问题描述】:

我正在使用 Highcharts js 库,尤其是 Highstock Timeseries 图表,例如:http://www.highcharts.com/stock/demo/

你知道我怎样才能在一个事件之后得到当前导航器的选择是什么?例如。假设我们可视化从 6 月 25 日到 6 月 27 日的数据,而整个可视化包括从 6 月 1 日到 6 月 30 日的数据,有没有办法检索显示选择的值:25th-27th?

如果我没有说清楚,请告诉我。

【问题讨论】:

    标签: javascript highcharts dom-events selection navigator


    【解决方案1】:

    根据 highcharts API 参考:

    events: {
        selection: function(event) {
            console.log(
                Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', event.xAxis[0].min),
                Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', event.xAxis[0].max)
            );
        }
    }
    

    demo

    reference

    【讨论】:

    • 太棒了!非常感谢!
    猜你喜欢
    • 1970-01-01
    • 2012-03-08
    • 1970-01-01
    • 1970-01-01
    • 2021-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-07
    相关资源
    最近更新 更多