jquery - jqplot animate pie chart and donut chart -


can tell me if animate , animate replot options in jqplot work pie chart , donut renderer? doesn't compatible option rendered can't find specific documentation.

what need, ideally, pie chart animate on replot new data. if animate options not working, done loading in new data sequentially, rather @ once, in similar way thread:

jqplot auto refresh chart dynamic ajax data

problem have example adds existing data, rather replacing , wasn't able work.

this got using example:

var storeddata = [3, 7];  var plot1; rendergraph();  $('.change1').click( function(){ doupdate(); }); $('.change2').click( function(){ doupdate2(); });  function rendergraph() { if (plot1) {     plot1.destroy(); }  var plot1 = $.jqplot('chart1', [storeddata], {seriesdefaults: {   renderer:$.jqplot.donutrenderer,   rendereroptions:{   slicemargin: 3,   startangle: -90,   showdatalabels: true,   datalabels: 'value'   } } }); }  var newdata = [9, 1, 4, 6, 8, 2, 5]; function doupdate() { if (newdata.length) {     var val = newdata.shift();          var newval = new number(val); /* update storeddata array*/         storeddata.push(newval);         rendergraph();          settimeout(doupdate, 1)  } else {     log("all done") } } function log(msg) { $('body').append('<div>'+msg+'</div>') } 

http://jsfiddle.net/p9sbp/106/

i have load new data , replace old data. can see, animate options stated not affecting replot:

var storeddata = [3, 7]; var newdata = [9, 1, 4, 6, 8, 2, 5];  $('.change1').click( function(){ plot1.replot({data: [newdata], resetaxes: true,}); });  var plot1 = $.jqplot('chart1', [storeddata], {animate: true, animatereplot: true, seriesdefaults: {    renderer:$.jqplot.donutrenderer,    rendereroptions:{    animation: {                 show: true             },    slicemargin: 3,   startangle: -90,   showdatalabels: true,   datalabels: 'value'   } } }); 

http://jsfiddle.net/p9sbp/107/

i'm thinking there must way combine 2 replaced data loads in animated/delayed way, , able control timing.

any appreciated.

many thanks

richard

just clear original data have before adding new data. e.g. so:

var wascleared = false; function doupdate() {     // empty existing data     if (!wascleared) {         storeddata.length = 0;         wascleared = true;     } ... 

here's first fiddle updated: http://jsfiddle.net/dekkard/6x82om3x/


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -