extjs - How can I have only one chart rendered upon an AJAX request? -


i using extjs 4 create charts. charts instantiated every time make ajax call. this:

$("#maincontent").getjson("path/to/jsondata",function(data) {   _chart.chart = ext.create("ext.chart.chart", {     axes   : _chart.axes()   , style  : 'background:#fff'   , series : _chart.series()   , store  : _chart.store()   , renderto : $("#chart").get(0)   , width  : sybus.utils.mainwidth()   , height : sybus.utils.mainheight()   }); }); 

the more invoke ajax call, more charts have on page. how can prevent happening , have 1 chart? thank you.

similar this question, have adapted answer suit context.

the answer issue out of extjs' responsability. code sample above missing cause of problem.

i have built class binds event function builds chart. everytime invoked ajax call retrieved data chart, function stacked binding on top, hence multiple charts.

the solution either check if have bound event or unbind() event , rebind() again.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -