PUDYASTO Report post Posted August 5, 2011 Whats wrong with my code : <?Php include ("koneksi.Php"); //connect to server include("FusionCharts.php"); $strXML = "<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showValues='1' showlegend='1' legendPosition='bottom' formatNumberScale='0' showBorder='1'>"; //Now create a second query to get details for this factory $strQuery = "SELECT SUM(qty) AS TotOutput,SUM(qty) + SUM(qty) AS TotOutput2,kd_brg FROM tjualtempjateng WHERE kd_brg BETWEEN '1-01-05-005-001' AND '2-01-02-01-0020' GROUP BY kd_brg ORDER BY kd_brg"; $result2 = mysql_query($strQuery) or die(mysql_error()); $strCategories = "<categories>"; while($ors2 = mysql_fetch_array($result2)){ $strCategories .= "<category name='" . $ors2['kd_brg'] . "' />"; } $strCategories .= "</categories>"; $strDataCurr = "<dataset seriesName='TotOutput'>"; while($ors2 = mysql_fetch_array($result2)){ $strDataCurr .= "<set value='" . $ors2['TotOutput'] . "' />"; } $strDataCurr .= "</dataset>"; $strDataCurr2 = "<dataset seriesName='TotOutput2'>"; while($ors2 = mysql_fetch_array($result2)){ $strDataCurr2 .= "<set value='" . $ors2['TotOutput2'] . "' />"; } $strDataCurr2 .= "</dataset>"; mysql_free_result($result2); //Finally, close <chart> element $strXML .= $strCategories . $strDataCurr . $strDataCurr2 . "</chart>"; echo renderChartHTML("Charts/MSColumn3D.swf", "", $strXML, "myNext", 1200, 500, false); ?> this result is empty chart, can you solve my problem? Share this post Link to post Share on other sites
Guest Angshu Report post Posted August 5, 2011 Hi, Welcome to FusionCharts Forum! Could you please send us the generated XML code to look into the issue? The XML generation process of multi-series chart is same as single-series chart, All you need to do is to build proper XML from the database that you query from your database. Multi-series charts have a different data format from the format of an XML for a single-series chart like pie. To know about multi-series chart data format, please visit the link: http://www.fusioncha...ultiSeries.html Hope this helps. Share this post Link to post Share on other sites
PUDYASTO Report post Posted August 6, 2011 I try to create xml from variable of php, like this $strXML = "<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showValues='1' showlegend='1' legendPosition='bottom' formatNumberScale='0' showBorder='1'>"; $strQuery = "SELECT SUM(qty) AS TotOutput,SUM(qty) + SUM(qty) AS TotOutput2,kd_brg FROM tjualtempjateng WHERE kd_brg BETWEEN '1-01-05-005-001' AND '2-01-02-01-0020' GROUP BY kd_brg ORDER BY kd_brg"; $result2 = mysql_query($strQuery) or die(mysql_error()); $strCategories = "<categories>"; // as <categories> while($ors2 = mysql_fetch_array($result2)){ $strCategories .= "<category name='" . $ors2['kd_brg'] . "' />"; } $strCategories .= "</categories>"; // as </categories> $strDataCurr = "<dataset seriesName='TotOutput'>"; // as <dataset> while($ors2 = mysql_fetch_array($result2)){ $strDataCurr .= "<set value='" . $ors2['TotOutput'] . "' />"; } $strDataCurr .= "</dataset>"; // as </dataset> $strDataCurr2 = "<dataset seriesName='TotOutput2'>"; // as <dataset> while($ors2 = mysql_fetch_array($result2)){ $strDataCurr2 .= "<set value='" . $ors2['TotOutput2'] . "' />"; } $strDataCurr2 .= "</dataset>"; // as </dataset> mysql_free_result($result2); $strXML .= $strCategories . $strDataCurr . $strDataCurr2 . "</chart>"; so, my xml is same as $strXml, For dataset1 is TotOutput and dataset2 is TotOutput2. For data from dataset I use looping from execute $strQuery (sorry if my english is not well) Share this post Link to post Share on other sites
MichelBR Report post Posted August 8, 2011 I try to create xml from variable of php, like this $strXML = "<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showValues='1' showlegend='1' legendPosition='bottom' formatNumberScale='0' showBorder='1'>"; $strQuery = "SELECT SUM(qty) AS TotOutput,SUM(qty) + SUM(qty) AS TotOutput2,kd_brg FROM tjualtempjateng WHERE kd_brg BETWEEN '1-01-05-005-001' AND '2-01-02-01-0020' GROUP BY kd_brg ORDER BY kd_brg"; $result2 = mysql_query($strQuery) or die(mysql_error()); $strCategories = "<categories>"; // as <categories> while($ors2 = mysql_fetch_array($result2)){ $strCategories .= "<category name='" . $ors2['kd_brg'] . "' />"; } $strCategories .= "</categories>"; // as </categories> $strDataCurr = "<dataset seriesName='TotOutput'>"; // as <dataset> while($ors2 = mysql_fetch_array($result2)){ $strDataCurr .= "<set value='" . $ors2['TotOutput'] . "' />"; } $strDataCurr .= "</dataset>"; // as </dataset> $strDataCurr2 = "<dataset seriesName='TotOutput2'>"; // as <dataset> while($ors2 = mysql_fetch_array($result2)){ $strDataCurr2 .= "<set value='" . $ors2['TotOutput2'] . "' />"; } $strDataCurr2 .= "</dataset>"; // as </dataset> mysql_free_result($result2); $strXML .= $strCategories . $strDataCurr . $strDataCurr2 . "</chart>"; so, my xml is same as $strXml, For dataset1 is TotOutput and dataset2 is TotOutput2. For data from dataset I use looping from execute $strQuery (sorry if my english is not well) friend, I have a problem same as yours, if you managed to solve, please send me the answer, I need a lot. thanks! Share this post Link to post Share on other sites
Naveen Ram Report post Posted August 9, 2011 Even I have the same problem. Could some one provide the solution with only PHP and mySQL without using XML content. Thanks quote name='MichelBR' timestamp='1312830443' post='39492'] friend, I have a problem same as yours, if you managed to solve, please send me the answer, I need a lot. thanks! Share this post Link to post Share on other sites
Guest Rishi Choudhari Report post Posted August 10, 2011 (edited) Hi, Just change this - $strCategories .= "<category name='" . $ors2['kd_brg'] . "' />"; } to this $strCategories .= "<category label='" . $ors2['kd_brg'] . "' />"; } Edited August 10, 2011 by Rishi Choudhari Share this post Link to post Share on other sites
MichelBR Report post Posted August 10, 2011 my chart did not work! could anyone help us?? Share this post Link to post Share on other sites
PUDYASTO Report post Posted August 12, 2011 my chart did not work! could anyone help us?? Can u give me your example? how did not work? Share this post Link to post Share on other sites
PUDYASTO Report post Posted August 13, 2011 Now with PHP I can solve My problem to..... This is My code and working with multiseries charts. <?php include "koneksi.php"; //Connection to Database include "FusionCharts.php"; //Charts $strXML = "<chart caption='Customers by QTY' yAxisName='QTY' xAxisName='Customers' numberPrefix='' formatNumberScale='0' rotateValues='1' placeValuesInside='1' decimals='0' >"; //Start XML Code connect_db(); //Call function of connection database $strquery = " SELECT kdpel, SUM(CASE WHEN kd_brg = '2-01-02-01-0005' THEN qty ELSE 0 END) AS MKIOS_05, SUM(CASE WHEN kd_brg = '2-01-02-01-0010' THEN qty ELSE 0 END) AS MKIOS_10, SUM(CASE WHEN kd_brg = '2-01-02-01-0020' THEN qty ELSE 0 END) AS MKIOS_20 FROM importjual WHERE (kd_brg BETWEEN '2-01-02-01-0005' AND '2-01-02-21-0100') AND (qty BETWEEN '1000' AND '8000') GROUP BY kdpel LIMIT 0,10"; //String Query database $query2 = mysql_query($strquery); //call string query $strCategories = "<categories>"; //create categories while ($cat = mysql_fetch_array($query2)) { $strCategories .= "<category label='" . $cat[0] . "' />"; //display categories }; $strCategories .= "</categories>"; $query3 = mysql_query($strquery); //call string query $K5 = "<dataset seriesName='MKIOS_05'>"; //create dataset while ($MK5 = mysql_fetch_array($query3)) { $K5 .= "<set value='" . $MK5[1] . "' />"; //display value of dataset } $K5 .= "</dataset>"; $query4 = mysql_query($strquery); //call string query $K10 = "<dataset seriesName='MKIOS_10'>"; //create dataset while ($MK10 = mysql_fetch_array($query4)) { $K10 .= "<set value='" . $MK10[2] . "' />"; //display value of dataset } $K10 .= "</dataset>"; $query5 = mysql_query($strquery); //call string query $K20 = "<dataset seriesName='MKIOS_20'>"; //create dataset while ($MK20 = mysql_fetch_array($query5)) { $K20 .= "<set value='" . $MK20[3] . "' />"; //display value of dataset } $K20 .= "</dataset>"; $strXML .= $strCategories . $K5 . $K10 . $K20 . "</chart>"; //end of XML echo renderChart("Charts/MScolumn3d.swf", "", $strXML, "productSales", 1400, 500, false, false); ?> I hope it can help your problems Share this post Link to post Share on other sites
Sanjukta Report post Posted August 16, 2011 Hi, Thanks for sharing. It would be helpful for many users. Happy FusionCharting! Share this post Link to post Share on other sites