score:27
Accepted answer
To update a chart I usually do this:
chart.series[0].update({
pointStart: newSeries[0].pointStart,
data: newSeries[0].data
}, true); //true / false to redraw
Try calling redraw after the update.
score:5
In my case, I want to initialise my chart before the data is available. So I initialise my chart with an empty series, and then I update it with addSeries
.
Full jsFiddle here: https://jsfiddle.net/qyh81spb/
My chart receives the data 2 seconds after being initialized:
MyChartComponent.initHighcharts();
setTimeout(function() {
MyChartComponent.setDataFromApi();
MyChartComponent.updateChart();
}, 2000);
So I initialise it with an empty series:
initHighcharts: function() {
this.chart = new Highcharts.Chart({
chart: {
type: 'column',
renderTo: 'container'
},
...
series: [] // initialisation with empty series. This is intentional
});
},
And whenever the data is available, I do this:
updateChart: function() {
this.dataFromApi.forEach(function(serie) { // for each row of data, add a series
this.chart.addSeries(serie, false); // false is to prevent redrawing
}.bind(this));
this.chart.redraw(); // manually redraw
this.chart.hideLoading(); // stop loading if showLoading() was call before
},
See the jsfiddle above for the full code details.
Source: stackoverflow.com
Related Query
- Highchart series update in javascript
- trying to dynamically update Highchart column chart but series undefined
- Dynamically update highchart series in meteor
- Update Series Array on HighChart after editing chart
- Why is the legend of my HighChart PieChart behaving irradically, when I update my series data?
- How to update HighChart series inside setInterval method
- Highchart not able to use javascript variables(arrays) in series data
- Column based Highchart drilldown series assign color code to each column
- Highchart doesn't show the graph : error adding javascript array in series
- Update Series Array on HighChart after editing the chart
- highcharts series update in javascript
- Moving javascript data series to html data attribute breaks Highchart
- Cannot dynamically update highchart in javascript
- Highchart - show / hide an y-Axis without hiding the series
- How to display highchart series line marker symbol from tooltip formatter?
- Reduce gap between series data in Bar Highchart
- Adding new HighChart Series
- Highcharts series update with animation
- Dynamic update of multiple series in highcharts
- Optimize JavaScript DrillDown code
- Call an angular component method when we click on highchart series
- Highchart (Column Chart) : Few data labels are not appearing for a series
- Series markers disable on lines and enable on legend in Highchart
- Highcharts how to use JavaScript variable as series data source?
- Highchart data series filled with different colors
- Hiding a highchart series is very slow
- How to change series legend text color in HighChart chart?
- Is it possible update Highchart data automatically and make animated effect?
- Animated series in highchart
- Highcharts-Vue wait for data then update series
More Query from same tag
- making highchart to be a dynamic data driven
- Dynamically load in series HighCharts
- how to use line-height property in highchart's labels
- extra tooltip for displaying yAxis values on right side
- Create multiple vertical plotlines on click and drag each of the plotline. Developed in Angular 6 and Highcharts
- display pie chart using highcharts api and mysql
- Highcharts: hide lines for categories
- How to add fill color in highcharts data series
- Format Highcharts y-axis labels
- Display data from CSV in Highcharts with Angular
- Highcharts lines not being drawn until browser is resized
- Highcharts timeline chart with multiple axes
- JSON, Highcharts and Coldfusion json data
- Highchart dual y-axes with same base and smaller tickinterval
- Hide Highcharts labels on resize and enlarge the chart
- Jquery: Dynamic binding events on a Highcharts object
- highcharts map bubble with categorized classes
- HighChart Test React error#13
- Highcharts and Extjs 4
- How do you get the extreme y-axis values in HighCharts?
- Legend order for proximate layout
- To apply different font styles to certain words in a Highcharts wordcloud?
- How to click on SVG element in highcharts to download file using Selenium
- Combining categories for column chart with Highcharts
- Multiple xAxis line on Highcharts
- Change legend size in highmaps?
- Highchart : xaxis Adding extra Dates randomly
- HighChart Line Draw issues(How to draw contineous line between 2 points )
- SVG Path having weird rounded-corner blocks
- how to get categories values and spacing in label in highcharts