To reload the entire chart following a data update in Highcharts, you can use the setData()
method. This method updates the chart with new data and redraws it.
Here's an example of how to use the setData()
method:
// Get a reference to the chart object
var chart = Highcharts.chart('container', {
// chart options...
});
// Update the chart data
var newData = [1, 2, 3, 4, 5];
chart.series[0].setData(newData);
// Redraw the chart with the updated data
chart.redraw();
In this example, we first get a reference to the chart object using the Highcharts.chart()
method. Then, we update the chart data by setting the data
property of the first series to a new array of data. Finally, we redraw the chart with the updated data using the redraw()
method.
Note that you'll need to replace container
with the ID of your chart's container element in the Highcharts.chart()
method. Also, if you have multiple series in your chart, you'll need to update the data
property for each series and call setData()
for each one.
Comments
Post a Comment