Following is the php code that I am using. Following example gives the multiseries bar chart according to selected start date & end date. But suppose I have given $start_date='2008-4-1' & $end_date = '2008-4-12' then following example gives the output (means bar) only for few dates between $start_date & $end_date. But following queries runs fine in database & gives correct output. But bar chart does not gives all records of queries. Tell me the solution?
$strXML = "<graph caption='Passport And Visa Sales' subcaption='(In Units)' xAxisName='Date' yAxisName = 'Quantity' formatNumberScale='0' decimalPrecision='0'>"
//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 (categories)
$strSQL = "SELECT DISTINCT(p.product_type_id) as ids, pt.product_type_desc as description FROM products as p, product_type as pt WHERE p.product_type_id >2 AND p.product_type_id = pt.product_type_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['description']."' color='". getFCColor() ."'>";
//Now, we get the data for that passport & visa counts
$strSQL = "SELECT SUM(Total) as output, days FROM(SELECT COUNT(oi.product_id) as Total, Day(o.order_complete) as days 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 >='$start_date' AND o.order_complete <='$end_date' AND o.order_id = oi.order_id AND oi.status_id <='6' GROUP BY days ORDER BY Total) as chart GROUP BY days ";
$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['output'] . "' />";
}
//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 .= "</graph>";