|
|
|
Forum Member
      
Group: Forum Members
Last Login: 4/29/2008 4:06:17 AM
Posts: 44,
Visits: 93
|
|
 Above bar chart does not display data according to query result. According to your suggestion I have checked xml file, according to that xml file it shows correct output. But my problem is with the flag that I am using for setting the day label( means 9,11,12 in above example).Above bar chart should show day 4 before 9 & one bar of orange color on that day.But it shows that on day '9' instead of day '4'. This is happening because of flag that I have used for setting day label( I am using the flag $catXMLDone that you have used in php & mysql free example multiseries example i.e. get sales by product bar chart). I am giving the following php code. can you tell me the solution? $strXML = "<graph caption='Factory Output ' subcaption='(In Units)' xAxisName='Date' formatNumberScale='0' decimalPrecision='0' palette='" . getPalette() . "' >"; //To store categories - also flag to check whether category is already generated $catXMLDone = false; //Initialize XML elements $strCat = "<categories>"; //First we need to get product type id from the database $strSQL = "SELECT DISTINCT(p.product_type_id) as ids FROM products as p WHERE p.product_type_id >='3' GROUP BY ids "; $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']."' color='".getFCColor()."' >"; $strSQL = "SELECT COUNT(oi.product_id) as Total, Day(o.order_complete) as days, p.product_type_id as typeid FROM order_items as oi, orders as o,products as p WHERE p.product_type_id = '".$orsCat['ids']."' AND p.product_id = oi.product_id AND o.order_complete >= '2008-4-4 00:00:00' AND o.order_complete <= '2008-4-12 00:00:00' AND o.order_id = oi.order_id GROUP BY days"; //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 name='" .$ors['days']. "' />"; } //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>"; } } //Close </categories> $strCat .= "</categories>"; //Create full XML $strXML .= $strCat.$strDataXML; //Close <graph> element $strXML .= "</graph>"; //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: Moderators
Last Login: Yesterday @ 1:21:47 AM
Posts: 675,
Visits: 1,079
|
|
|
|
|
|
Supreme Being
      
Group: Moderators
Last Login: Yesterday @ 1:21:47 AM
Posts: 675,
Visits: 1,079
|
|
| Hi, Could you please refer to the post :http://www.fusioncharts.com/forum/FindPost5916.aspx for the reply?
Regards,
Sudipto Choudhury FusionCharts Team
|
|
|
|