Highcharts's onReady event?

后端 未结 3 1201
一个人的身影
一个人的身影 2021-02-19 03:34

Is there any onReady (or similar) ready event for HighCharts?

Currently, HighCharts only offers addSeries, click, load

3条回答
  •  情歌与酒
    2021-02-19 04:04

    The Highcharts.Chart constructor takes a callback argument that is called "when the chart object is finished loading and rendering". The chart object is passed as an argument to the callback.

    $("#the-chart").highcharts(options, function (chart) {
        alert("The chart is ready now");
        console.log("chart", chart);
    });
    

    Chart (Object options, Function callback) This is the constructor for creating a new chart object.

    Parameters

    • options: Object
      The chart options, as documented under the heading "The options object"in the left menu.

    • callback: Function
      A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread, but in Internet Explorer version 8 or lessthe chart is sometimes initiated before the document is ready, and in thesecases the chart object will not be finished directly after callingnew Highcharts.Chart(). As a consequence, code that relies on the newly built Chart object should always run in the callback. Defining a chart.event.load handler is equivalent.

    Returns

    • Chart

提交回复
热议问题