Wally Kolcz Report post Posted May 22, 2012 I am attempting to create a dashboard using FusionCharts and PHP. I have a XML generator class that seems to produce the correct XML for the chart to form the charts I copied out the results and pasted it into a static document and the chart generate fine. However I have no idea how to use the information in the return variable to actually generate the charts. It keeps failing. When I read the page source it looks right.. var chart_chart1 = new FusionCharts( { "swfUrl" : "assets/FusionCharts/MSColumn3D.swf", "width" : "425", "height" : "300", "renderAt" : "chart1Div", "renderer" : "javascript", "dataFormat" : "xmlurl", "id" : "chart1", "dataSource" : "<chart caption="" XAxisName="" palette="2" animation="1" formatNumberScale="0" numberPrefix="" showValues="0" numDivLines="4" legendPosition="BOTTOM><categories><category label='Total Referrals' /><category label='Total Consults' /></categories><dataset seriesName="Q1"><set value='9668' /><set value='3357' /></dataset><dataset seriesName="Q2"><set value='9154' /><set value='3264' /></dataset><dataset seriesName="Q3"><set value='' /><set value='' /></dataset><dataset seriesName="Q4"><set value='' /><set value='' /></dataset><styles><definition><style type="font" name="CaptionFont" color="666666" size="15" /><style type="font" name="SubCaptionFont" bold="0" /></definition><application><apply toObject="caption" styles="CaptionFont" /><apply toObject="SubCaption" styles="SubCaptionFont" /></application></styles></chart>" } ).render(); Here is my generation string. <?php //Get this charts data by ID and year $data = $chardata->getChartXML('2', $_GET['year']); // Set the rendering mode to JavaScript FC_SetRenderer('javascript'); // Call the renderChart method, which would return the HTML and JavaScript required to generate the chart echo renderChart("assets/FusionCharts/MSColumn3D.swf", "$data", "", "chart1", 425, 300, false, true); ?> I've tried the return variable as both the 2nd and 3rd variable. Thanks! Share this post Link to post Share on other sites
Guest Sashibhusan Report post Posted May 23, 2012 Hi, Thank you for the post. With regard to your query, it seems that the generated XML posted here is malformed. Please check for the closing (quote) for "legendPosition" attribute value in the <chart> element. Hope this helps! Share this post Link to post Share on other sites
Wally Kolcz Report post Posted May 23, 2012 Nope. Sorry, must have been a problem when I copied and pasted it. It has both closing and opening. Good catch though! Hi, Thank you for the post. With regard to your query, it seems that the generated XML posted here is malformed. Please check for the closing (quote) for "legendPosition" attribute value in the <chart> element. Hope this helps! Share this post Link to post Share on other sites
Guest Sashibhusan Report post Posted May 24, 2012 Hi, Form the page source code that you have posted, it seems that, you are providing XML data string in place of XML URL argument in the PHP method "renderChart();". Code Snippet: "dataFormat" : "xmlurl" but "dataSource" : " XML String..." So, could you please provide the XML string ($data) properly , as mentioned below: echo renderChart("assets/FusionCharts/MSColumn3D.swf", "", $data, "chart1", 425, 300, false, true); // Provide $data as a PHP variable (without double quote) for the data string parameter For more information on "Using with PHP > Basic Example > renderChart Parameter Description", please follow the link below: http://docs.fusioncharts.com/charts/contents/?guide-for-web-developers/php/PHP_BasicExample.html Hope this helps! Share this post Link to post Share on other sites
Wally Kolcz Report post Posted May 24, 2012 Thanks for the input, but as I mention in the last line of my original post, I actually tried the $data variable in both the 2nd and 3rd arguments. So I tried them both with no luck. Hi, Form the page source code that you have posted, it seems that, you are providing XML data string in place of XML URL argument in the PHP method "renderChart();". Code Snippet: "dataFormat" : "xmlurl" but "dataSource" : " XML String..." So, could you please provide the XML string ($data) properly , as mentioned below: echo renderChart("assets/FusionCharts/MSColumn3D.swf", "", $data, "chart1", 425, 300, false, true); // Provide $data as a PHP variable (without double quote) for the data string parameter For more information on "Using with PHP > Basic Example > renderChart Parameter Description", please follow the link below: http://docs.fusionch...sicExample.html Hope this helps! Share this post Link to post Share on other sites
Guest Sashibhusan Report post Posted May 24, 2012 Hi, Could you please confirm that you have provided the $data to the 3rd argument without double quotes? If yes, please share the page source code generated, with us. Share this post Link to post Share on other sites
Wally Kolcz Report post Posted May 24, 2012 Yep, with and without in the 2nd and 3rd spot. Hi, Could you please confirm that you have provided the $data to the 3rd argument without double quotes? If yes, please share the page source code generated, with us. Share this post Link to post Share on other sites
Guest Sashibhusan Report post Posted May 25, 2012 Yep, with and without in the 2nd and 3rd spot. Hi, Could you please try echoing the $data value to the browser and check whether you are getting correct XML string output? It seems rest of the code is correct. So can you share the Firebug console output, if you are getting any error? Also if possible can you please provide us the sample code to replicate the issue from our end? Awaiting inputs from your end. Share this post Link to post Share on other sites
Wally Kolcz Report post Posted May 25, 2012 I've been trying to debug it. I ended up just copying out the code from the function directly into a .php page and echoing it back and it works fine. Just confused why the echo works and the return of a variable with the same data fails. If you have an email address, I'll be more than happy to shoot you the view and the class I created to see where my error might be. Hi, Could you please try echoing the $data value to the browser and check whether you are getting correct XML string output? It seems rest of the code is correct. So can you share the Firebug console output, if you are getting any error? Also if possible can you please provide us the sample code to replicate the issue from our end? Awaiting inputs from your end. Share this post Link to post Share on other sites
Sanjukta Report post Posted May 25, 2012 Hi, Please mail us with all the details at "[email protected]". We would get back to you at the earliest. Hope this helps. Share this post Link to post Share on other sites