Anyone use Ajax to refresh the charts on their page?
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Anyone use Ajax to refresh the charts on... Expand / Collapse
Author
Message
Posted 11/13/2007 9:20:36 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 12/1/2007 11:20:45 AM
Posts: 3, Visits: 10
Hey everyone!

Has anyone created a page where they're using AJAX to grab and display charts (using php with a mysql database delivering the data)?

I have an AJAX script setup and it replaces the chart area with the file called, however it fails at the rendering of the chart and I get "Chart." instead of the animated chart.

Any suggestions?

Thanks!

- Also it might be worth noting that the chart page(s) render properly on their own, it's only when called from AJAX.
Post #3035
Posted 11/14/2007 12:56:29 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Today @ 5:38:52 AM
Posts: 884, Visits: 1,420
Hi,
If you are re rendering the chart or reloading another/same SWF using AJAX you better avoid using PHP renderChart() function. Because that would simply write the HTML DIV with 'Chart' text in it and  javascript to render the chart inside that DIV.  Since AJAX is used the javascript wont be eval'ed and hence you could only see 'Chart'.
 
I would rather suggest you  to use renderChartHTML() function. This will put only OBJECT/EMBED tags as HTML and not javascript to eval'ed. This wont show you the IE 'Click here to Activate..' message since AJAX uses JavaScript to put that HTML. This would solve your problem.


Regards,

Sudipto Choudhury
FusionCharts Team
Post #3042
Posted 11/15/2007 12:58:52 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 12/1/2007 11:20:45 AM
Posts: 3, Visits: 10
!!!

It was that easy!! I can't believe it!

Thank you, it's working perfectly now!


Post #3064
Posted 12/8/2007 5:52:49 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 12/8/2007 3:55:14 PM
Posts: 1, Visits: 5
Even though you've found a solution, another option would be to use the php wrapper class to create the raw XML data by creating a normal chart and using getXML() and pass that to a javascript function to render the chart...

I'm mainly doing things this way because i'm also passing other data to the javascript function via a single AJAX request to build a whole section of reports.

maybe thats not the best way i'm not really sure, but the phpClass wrapper doesn't seem to have the renderChartHTML() function in the class...but oh well the direct XML also works.

Post #3302
Posted 1/17/2008 3:28:41 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 3/28/2008 11:00:05 AM
Posts: 5, Visits: 16
Hi, i was wondering if it is possible not to use xml for your solution. For example, I'm populating arrays from a mysql database, and I'm generating a graph like this:


$FC = new FusionCharts("MSLine","600","300");
$FC->setSwfPath("FusionCharts/Charts/");
$strParam="caption=Sales by Product;numberPrefix=$;formatNumberScale=1;rotateValues=1;decimalPrecision=0";
$FC->setChartParams($strParam);
$FC->addChartDataFromArray($arrData, $arrCatNames);

echo "";
$FC->renderChart();


All of which i took from the documentation. As you can see, i use the $arrData variable which has all my data. Is there a way to continue doing with with the solution provided (using renderChartHTML() ), or do i have to convert my arrays to an xml string?
Post #3907
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 6:04pm


Execution: 0.094.