DonnaPowell
New Member
here is working fusion chart demo code:\[code\]<?phpinclude("FusionCharts/FusionCharts.php");?><HTML><HEAD> <TITLE> FusionCharts - Array Example using Single Series Column 3D Chart </TITLE> <SCRIPT LANGUAGE="Javascript" SRC="http://stackoverflow.com/questions/14030488/FusionCharts/FusionCharts.js"></SCRIPT> <script type="text/javascript" language="JavaScript" src="http://stackoverflow.com/questions/14030488/FusionCharts/FusionChartsExportComponent.js"></script><script type="text/javascript" LANGUAGE="Javascript" SRC="http://stackoverflow.com/questions/14030488/FusionCharts/jquery.min.js"></script><script type="text/javascript" LANGUAGE="Javascript" SRC="http://stackoverflow.com/questions/14030488/FusionCharts/lib.js"></script><link href="http://stackoverflow.com/questions/14030488/FusionCharts/style.css" rel="stylesheet" type="text/css" /><script type="text/javascript"> function ExportMyChart() { var chartObject = getChartFromId('Results'); if( chartObject.hasRendered() ) chartObject.exportChart(); } </script> <style type="text/css"> <!-- body { font-family: Arial, Helvetica, sans-serif; font-size: 12px; } --> </style></HEAD><BODY><CENTER><h2>FusionCharts Examples</h2><h4>Plotting single series chart from data contained in Array.</h4><?phpinclude("db_connect.php"); //In this example, we plot a single series chart from data contained //in an array. The array will have two columns - first one for data label //and the next one for data values. //Let's store the sales data for 6 products in our array). We also store //the name of products. //Store Name of grades for x axis $arrData[0][1] = "A"; //send + char to xml file//// $arrData[1][2] = str_replace('+', '%2B', 'A+'); $arrData[2][3] = "A-"; $arrData[3][4] = "B"; $arrData[4][5] = str_replace('+', '%2B', 'B+'); $arrData[5][6] = "B-"; $arrData[6][7] = "C"; $arrData[7][8] = str_replace('+', '%2B', 'C+'); $arrData[8][9] = "C-"; $arrData[9][10] = "D"; $arrData[10][11] = str_replace('+', '%2B', 'D+'); $arrData[11][12] = "E"; $arrData[12][13] = "AB"; $arrData[13][14] = "NE"; $arrData[14][15] = "MC"; //Store db data // Fetch all records $sql = "SELECT grade, COUNT(*) 'Nf_grades' FROM std_results WHERE course_code ='CSC1113' GROUP BY grade ORDER BY grade ASC"; $result = mysql_query($sql) or die(mysql_error()); while($ors = mysql_fetch_array($result)) { $grd=$ors['grade']; switch ($grd){case "A": $arrData[0][16]=$ors['Nf_grades']; break;case "A+": $arrData[1][17]=$ors['Nf_grades']; break;case "A-": $arrData[2][18]=$ors['Nf_grades']; break; case "B": $arrData[3][19]=$ors['Nf_grades']; break; case "B+": $arrData[4][20]=$ors['Nf_grades']; break; case "B-": $arrData[5][21]=$ors['Nf_grades']; break; case "C": $arrData[6][22]=$ors['Nf_grades']; break; case "C+": $arrData[7][23]=$ors['Nf_grades']; break; case "C-": $arrData[8][24]=$ors['Nf_grades']; break; case "D": $arrData[9][25]=$ors['Nf_grades']; break; case "D+": $arrData[10][26]=$ors['Nf_grades']; break; case "E": $arrData[11][27]=$ors['Nf_grades']; break; case "AB": $arrData[12][28]=$ors['Nf_grades']; break; case "NE": $arrData[13][29]=$ors['Nf_grades']; break;default: $arrData[14][30]=$ors['Nf_grades'];} } //set vlaue zero for othe grades.. for($i=0;$i<15;$i++){ if(!isset($arrData[$i][31])){ $arrData[$i][32]=0; } } //Now, we need to convert this data into XML. We convert using string concatenation. //Initialize <chart> element $strXML = "<chart caption='Exam result for CSC113A ' numberPrefix='' formatNumberScale='10' xAxisName='Grades' yAxisName='No Of Students' bgColor='995699,FEEFFF' exportEnabled='1' exportAtClient='0' exportAction='download' exportTargetWindow='_blank' exportHandler='http://www.fusioncharts.com/ExportHandlers/PHP/FCExporter.php' id='myChart'>"; //Convert data to XML and append foreach ($arrData as $arSubData) $strXML .= "<set label='" . $arSubData[1] . "' value='" . $arSubData[2] . "' />"; //Close <chart> element $strXML .= "</chart>"; //Create the chart - Column 3D Chart with data contained in strXML echo renderChart("FusionCharts/Column3D.swf", "", $strXML, "Results", 600, 300, false, false);?><BR><BR><input type="button" value="http://stackoverflow.com/questions/14030488/Export My Chart" onclick="ExportMyChart()" /></CENTER></BODY></HTML>\[/code\]output of this code is:!
then I try it edit above code to add download button to export these charts to as imges/PDF format..but this download button still not display for me.needed download button is:
then I need to get final out put like this :
I want add this download button to my chart...how can I do this ???please help me frnds.....