|
|
|
Forum Member
      
Group: Forum Members
Last Login: 4/29/2008 4:06:17 AM
Posts: 44,
Visits: 93
|
|
| //following is php code .but does not give any output. first query give the following data through database ids 1 2 3 second query give following data through database for ids=1 Total month product_id 1 2 1 2 3 1 3 4 1 same data come for ids =2 & ids=3 with same values of month & different Total but following php code does not give any output <?php //Generate the graph element string $strXML = "<chart caption='Factory Output ' subcaption='(In Units)' xAxisName='Date' formatNumberScale='0' decimalPrecision='0'>"; // Connet to the DB $link = connectToDB(); //To store categories - also flag to check whether category is //already generated $catXMLDone = false; //Initialize XML elements $strCat = "<categories>"; //First we need to get unique categories in the database $strSQL = "Select product_id as ids from products where product_id <='3' ORDER BY product_id"; $result = mysql_query($strSQL) or die(mysql_error()); //To store datasets and sets $strDataXML = ""; if ($result) { while($orsCat = mysql_fetch_array($result)) { //Add this category as dataset $strDataXML .= "<dataset seriesName='" .$orsCat['ids']. "'>"; //Now, we get the data for that factory $strSQL = "SELECT count(oi.product_id) as Total, Month(o.order_complete) as month, oi.product_id FROM order_items as oi, orders as o,products as p WHERE oi.product_id='".$orsCat['ids']."' AND p.product_id = oi.product_id AND o.order_id = oi.order_id GROUP BY Month(o.order_complete) "; //Execute it $result2 = mysql_query($strSQL) or die(mysql_error()); while($ors = mysql_fetch_array($result2)) { //Append <category label=''> if not already done if (!$catXMLDone) { $strCat .= "<category label='" .$ors['month'] . "' />"; } //Append data $strDataXML .= "<set value='" . $ors['Total'] . "' />"; } //Update flag that we've appended categories $catXMLDone = true; //Clear up objects mysql_free_result($result2); //Close dataset element $strDataXML .= "</dataset>"; } } mysql_close($link); //Close </categories> $strCat .= "</categories>"; //Create full XML $strXML = $strCat . $strDataXML; //Return return $strXML; //Close <graph> element $strXML .= "</chart>"; //Create the chart - Column 2D Chart with data from strXML echo renderChart("FusionCharts/FCF_MSColumn3D.swf", "", $strXML, "FactoryDetailed", 600, 300, false, false); ?>
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: Yesterday @ 11:57:38 PM
Posts: 173,
Visits: 1,003
|
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 4/29/2008 4:06:17 AM
Posts: 44,
Visits: 93
|
|
| I have changed chart to graph. but still it is not working.
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: Yesterday @ 11:57:38 PM
Posts: 173,
Visits: 1,003
|
|
| Hi maheshshinde9 Could you please remove return from your code and try again? //Return // return $strXML; no need of that
Thanks, Arindam FusionCharts Team www.fusioncharts.com
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 4/29/2008 4:06:17 AM
Posts: 44,
Visits: 93
|
|
| still it it showing blank output.
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 4/29/2008 4:06:17 AM
Posts: 44,
Visits: 93
|
|
| when I used FCF_MSColumn3D.swf instead of MSColumn3D it shows invalid xml data error & if I use MSColumn3D.swf it doesnot show anything (blank output). Also I have removed return xml;
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: Yesterday @ 11:57:38 PM
Posts: 173,
Visits: 1,003
|
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 4/29/2008 4:06:17 AM
Posts: 44,
Visits: 93
|
|
| how to get xml output? please tell me.
|
|
|
| | |