javascript - Change chart type and redraw with multiple series in Highcharts -


i have dashboard various charts, each adjacent dropdown change type of chart. i'm hoping accomplish redrawing chart rather destroying , creating new one.

i first stumbled upon solution seems highcharts team, in investigating, seems broken. upon selecting "column" select, chart re-renders without first series data. found consistent issue...highcharts wants render last series way using "addseries" method:

for(var i=0;i<series.length;i++) {     serie = series[0];     serie.chart.addseries({         type: newtype,         name: serie.name,         color: serie.color,         data: serie.options.data     }, false);      serie.remove(); }  var chart = new highcharts.chart(options, function(chart){      $('#charttype').change(function(){         changetype(chart.series, this.value);     });  }); 

try selecting "column" in select here: http://jsfiddle.net/2hlr5/

i found had accomplished using older version of highcharts , jquery 1.7.1. can see working example here: http://highcharts.com/jsbin/etulob/edit#javascript,live

in replicating code uses, found jquery 1.9.1 replicate chart original column line chart, chokes when trying switch line chart columns. can see here: http://highcharts.com/jsbin/etulob/9/edit#javascript,live

my best guess data column charts has changed since previous versions of highcharts, thats total stab in dark.

any appreciated.

see previous answer here. explains how use series.update() function change type of graphs.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -