图表重绘时的HighCharts股票图表火灾事件?

Kyl*_*man 1 javascript jquery highcharts highstock

我正在使用HighStock股票图表库来生成基本的OHLC股票图表.我想在生成图表时(以及通过更改显示的时间框架重新生成图表后)执行某些操作.我正在尝试使用plotOptions.ohlc.events.show事件(文档)来做到这一点.

我遇到的问题是甚至没有开火.如果我按照单击事件示例,则单击该系列时警报会正确触发.

var chart = new Highcharts.StockChart({
    chart: {
        renderTo: 'divChart',
        height: 450
    },

    rangeSelector: {
        selected: 2
    },

    xAxis: {
        maxZoom: 14 * 24 * 3600000
    },

    yAxis: [{
        title: {
            text: 'OHLC'
        },
        height: 200,
        lineWidth: 2
    }, {
        title: {
            text: 'Volume'
        },
        top: 250,
        height: 100,
        offset: 0,
        lineWidth: 2
    }],

    title: {
        text: 'Stock Chart'
    },

    series: [{
        type: 'ohlc',
        name: 'Prices',
        id: 'prices',
        data: ohlc
    }, {
        type: 'column',
        name: 'Volume',
        data: volume,
        yAxis: 1
    }],

    // The event I am trying to bind to
    plotOptions: {
        series: {
            events: {
                show: function () {
                    alert("show");
                }
            }
        }
    }
});
Run Code Online (Sandbox Code Playgroud)
  • 这是重绘图表时触发事件的正确方法吗?
  • 如果是这样,为什么不发射事件,我该如何解决?

tor*_*orm 6

将图表部分更改为类似的部分

chart: {
        renderTo: 'container',
        events: {
            redraw: function(){   // or load - refer to API documentation
             alert('Chart Loaded');   
            }
        }
    },
Run Code Online (Sandbox Code Playgroud)

他们有一个很好的API浏览器 - 可能会派上用场 http://www.highcharts.com/ref/#chart-events--load