I am trying to update an existing data series with a new data array and call the redraw function upon completion. Although this works just fine, I am not completely satisfied that I would like to have some kind of transition to growth / reduction. I saw an example using Highcharts (spin with an existing dataset, then click the "Install new data in the selected series" button), but I cannot reproduce this behavior.
Here is the code I wrote:
var series, newSeriesThreshold = this.chart.series.length * 2; for (var i = 0; i < data.length; i += 2) { series = { name: this.data[i].title, data: this.data[i].data, color: this.data[i].color }; if (i >= newSeriesThreshold) { this.chart.addSeries(series, false); } else { var currentSeries = this.chart.series[i / 2]; currentSeries.setData(series.data, false); } } this.chart.redraw();
These are the options when creating the chart:
var config = { chart: { renderTo: $(this.container).attr('id'), type: this.settings.type, animation: { duration: 500, easing: 'swing' } }, title: { text: null }, legend: { enabled: this.settings.legend.show }, tooltip: { formatter: function() { return this.x.toFixed(0) + ": <b>" + this.y.toString().toCurrency(0) + '</b>'; } }, xAxis: { title: { text: this.settings.xaxis.title, style: { color: '#666' } } }, yAxis: { title: { text: this.settings.yaxis.title, style: { color: '#666' } } }, series: series, plotOptions: { column: { color: '#FF7400' } }, credits: { enabled: false } };
This gives an immediate update without transition effects. Any ideas what I can do wrong?
source share