Sign in to follow this  
steveddei

Dynamically Generated Charts, Render one at a time

Recommended Posts

I am dymaically generating multiple rows of charts using Zend/PHP in a Zend partialLoop. I want to render/load one chart at a time. Each chart should wait until the previous chart has loaded in the client browser.

Here is a snippet of the existing code.

echo "<td>";
echo renderChart("/Charts/Area2D.swf", "",$this->FCOBJA, "groupFCA".$id, 90, 30, false, false);

echo "</td>
<td>";
echo renderChart("/Charts/Column2D.swf", "",$this->FCOBJB, "groupFCB".$id, 90, 30, false, false);

echo "</td>
<td>";

echo renderChart("/Charts/Area2D.swf", "",$this->FCOBJC, "groupFCC".$id, 90, 30, false, false);

echo "</td>
<td>";
echo renderChart("/Charts/Column2D.swf", "",$this->FCOBJD, "groupFCD".$id, 90, 30, false, true);

echo "</td>";

Currenly I am watching the callback fro the last chart, so I know when i can hide a 'Loading' overlay.How would I go about loading the charts one at a time in the clients browser using javascript and the callbacks?

Right now all charts try to load at the same time.(very slow, freezes in Safari)

Edited by Guest

Share this post


Link to post
Share on other sites

Figured out myself...

I commented out chart_$chartId.render("$chartIdDiv"); from FusionChart.php

then on my page, I kept track of the Ids of the dynamically generated charts. With Php i construct Javascript code to build a switch statement in the FC_Rendered(DOMId); function.

When i receive the event for one, I load the next. Of course before that i need to manual start the fisrt chart to start off the motion. 

Share this post


Link to post
Share on other sites

HI steveddei,

 

i have Figured out a solution.

 

 

 

build a javascript 2D array using php which contain all the data needed to rendered the chart(i.e. xml,swf file, html div/span id where the perticular chart will be rendered ,width,height and other conditions).

 

 

 

then page onload call a function (let say ABC()) which will pop the array(if not empty) and build the chart on basis of the array data.

 

 

 

and also FC_Rendered() will call the function ABC().

 

so on page load it automatically create the first chart and after every chart rendered it will create the next chart until the array became empty

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this