Eilons Report post Posted January 3, 2012 Hey everyone! I have got a question about linked charts (combination charts) with database. I read the tutorial in this topic in [url="http://docs.fusioncharts.com/charts/?PHP_DB.html"]http://docs.fusioncharts.com/charts/?PHP_DB.html[/url] and i cant understand why it is not showing the two charts on the same page when I pressed. Here is my code: (I have alreday checked all my queary and it's working fine) <?php include("../../FusionCharts_Evaluation/Code/PHP/Includes/FusionCharts.php"); include("Functions.php"); include '../../func/form_function.php' ; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]"> <HTML> <head> <title>תרומות לפי התפלגות שנים </title> <link rel="stylesheet" type="text/css" href="../../STYLE/style_chart.css"/> <link rel="stylesheet" type="text/css" href="../../STYLE/style_button.css"/> <script LANGUAGE="Javascript" SRC="../../FusionCharts_Evaluation/Charts/FusionCharts.js"></SCRIPT> <script LANGUAGE="JavaScript"> function updateChart(factoryIndex){ var strURL = "ChartByYearData.php?year=" + factoryIndex; FusionCharts("DonationByYear").setXMLUrl(strURL); } </SCRIPT> </head> <body DIR="RTL" > <CENTER> <?PHP date_default_timezone_set('Asia/Tel_Aviv'); $year1=$_GET["year1"]; $year2=$_GET["year2"]; $strXML="<chart caption=' $year2 :לבין $year1 :סך תרומות בשקלים בין ' formatNumberScale='0' yAxisMaxValue='1' numberPrefix='שח' xAxisName='שנים' yAxisName='תרומות' centerYaxisName='0' baseFontSize='15'>"; $data=DonationAmountYear($year1,$year2); $labels=array(); for ($LowYear=$year1; $LowYear<=$year2; $LowYear++) { $labels[]= $LowYear; } for ($LowYear=$year1; $LowYear<=$year2; $LowYear++) { $links[]= $LowYear; } for($i=0; $i< sizeof($data); $i++) { $strXML .= "<set label='" . $labels[$i] . "' value='" . $data[$i] . "' link='javaScript:updateChart(" . $links[$i] . ")'/>"; } //Close <chart> element $strXML .= "</chart>"; echo renderChart("../../FusionCharts_Evaluation/Code/FusionCharts/Column3D.swf", "", $strXML, "DonationByRangeYear", 700, 500, false, true); echo renderChart("../../FusionCharts_Evaluation/Code/FusionCharts/Column3D.swf?ChartNoDataText=לחץ על שנה בגרף למעלה כדי להציג פירוט לפי חודשים.", "", "<chart></chart>", "DonationByYear", 600, 250, false, true); mysql_close($dbcnx); ?> </center> <div class="buttonwrapper"> <a class="ovalbutton" href="DisplayOptions.html" style="margin-left: 6px"><span>חזרה</span></a> </div> </body> </html> ***The javascript calling to this page: <?php include("../../FusionCharts_Evaluation/Code/PHP/Includes/FusionCharts.php"); include("Functions.php"); include '../../func/form_function.php' ; date_default_timezone_set('Asia/Tel_Aviv'); $year=$_GET['year']; $strXML="<chart palette='2' caption=' $year :בשנת בשקלים תרומות סך ' formatNumberScale='0' yAxisMaxValue='1' numberPrefix='שח' xAxisName='חודשים' yAxisName='תרומות' centerYaxisName='0' baseFontSize='15'>"; $data=DonationAmount($year); $labels[0]="Jan"; $labels[1]="Feb"; $labels[2]="Mar"; $labels[3]="Apr"; $labels[4]="May"; $labels[5]="Jun"; $labels[6]="Jul"; $labels[7]="Aug"; $labels[8]="Sep"; $labels[9]="Oct"; $labels[10]="Nov"; $labels[11]="Dec"; for($i=0; $i< sizeof($data); $i++) { $strXML .= "<set label='" . $labels[$i] . "' value='" . $data[$i] . "' />"; } //Close <chart> element $strXML .= "</chart>"; echo $strXML; mysql_close($dbcnx); ?> this is a picture of what i'm getting after pressing the link: THANKS!!! Share this post Link to post Share on other sites
Swarnam Report post Posted January 4, 2012 Hi, echo renderChart("../../FusionCharts_Evaluation/Code/FusionCharts/Column3D.swf", "", $strXML, "DonationByRangeYear", 700, 500, false, true); >>The above code is displayed as Column 3D chart in the image you had attached. echo renderChart("../../FusionCharts_Evaluation/Code/FusionCharts/Column3D.swf?ChartNoDataText=לחץ על שנה בגרף למעלה כדי להציג פירוט לפי חודשים.", "", "<chart></chart>", "DonationByYear", 600, 250, false, true); >>The above code doesn't contain any data that could be plotted by FusionCharts. In this case, your XML just contains the <chart> </chart> tags without any data between them. I hope this helps Share this post Link to post Share on other sites
Eilons Report post Posted January 4, 2012 (edited) Hi! Thank you for your quick answer. you suggested me to handle the line with <chart></chart> but it was wirten in the tutorial that <chart></chart> used for initalization and by writting "DonationByYear" it's calling to the script function to generate the xml file. Am i missing something in this tutorial? http://docs.fusioncharts.com/charts/?PHP_DB.html Hi, echo renderChart("../../FusionCharts_Evaluation/Code/FusionCharts/Column3D.swf", "", $strXML, "DonationByRangeYear", 700, 500, false, true); >>The above code is displayed as Column 3D chart in the image you had attached. echo renderChart("../../FusionCharts_Evaluation/Code/FusionCharts/Column3D.swf?ChartNoDataText=לחץ על שנה בגרף למעלה כדי להציג פירוט לפי חודשים.", "", "<chart></chart>", "DonationByYear", 600, 250, false, true); >>The above code doesn't contain any data that could be plotted by FusionCharts. In this case, your XML just contains the <chart> </chart> tags without any data between them. I hope this helps Edited January 4, 2012 by Eilons Share this post Link to post Share on other sites
Guest Sashibhusan Report post Posted January 5, 2012 Hi, Thanks for the post. Upon going through your code I have concluded that your codeseems correct. As you are taking data for chart by using some functions which are defined in a separate *.php file. But please check the below mentioned in your code for conformation: 1. Enable the debug mode and check whether the XMLis generated correctly after clicking the link or not? 2. Check by printing the “ factoryIndex” value is getting right value or not ? If the problem still persists then please provide the entirecode with screenshot of JavaScript debug mode enabled so that I can test itfrom my side. Hope this helps!! Share this post Link to post Share on other sites
Eilons Report post Posted January 6, 2012 Hi, first of all thank you for your answer! I attached some screenshots and a view source image. I think that there is a problem in the connection between the two pages because it's not Generating an xml file at all. Hi, Thanks for the post. Upon going through your code I have concluded that your codeseems correct. As you are taking data for chart by using some functions which are defined in a separate *.php file. But please check the below mentioned in your code for conformation: 1. Enable the debug mode and check whether the XMLis generated correctly after clicking the link or not? 2. Check by printing the “ factoryIndex” value is getting right value or not ? If the problem still persists then please provide the entirecode with screenshot of JavaScript debug mode enabled so that I can test itfrom my side. Hope this helps!! Share this post Link to post Share on other sites