angularjs - Highcharts smooth transition on data update using Angular and ng-highcharts -


i've made prototype of highchart works strictly in jquery. had bunch of spaghetti code, had nice transitional animation when selecting controller animate chart , update series. in short, done so...

var chart = new highcharts.chart(chartoptions); // ... $('select#dropdown').change(function(){   // ...   chart.series[0].setdata(/*data*/, false);   chart.series[1].setdata(/*data*/, false);   chart.series[2].setdata(/*data*/, false);   // ...   chart.redraw(); } 

so chart (1) initialized on page load, (2) takes argument dropdown box (3) decides new value given series , (4) smoothly redraws chart value.

my problem i'm having difficult time re-producing in angular. highcharts-ng, seems have every example under sun except updating existing points.

http://pablojim.github.io/highcharts-ng/examples/example.html

there things adding series, deleting series etc.. updating series? if wanted series tied scope variable, changing? how make $scope.$watch on drop-down box tell chart update points?

the key update data array in series , highcharts take care of smooth transition. example:

 $scope.chartconfig.series[0].data = rnd; 

here have updated example show smooth update transition: jsfiddle

and example drop down , watch : jsfiddle

hope helps. let me know if have questions on how works.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -