simple bar chart with mysql as database
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



simple bar chart with mysql as database Expand / Collapse
Author
Message
Posted 4/16/2008 8:34:35 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 4/29/2008 4:06:17 AM
Posts: 44, Visits: 93
this is php code i am using.

This example works with pie chart but not with bar chart. I tried to use different chart

in renderchart sentense .but it did not work .I used order by clause in sql sentense then also it didnot work. give me solution.

<?php
  $link = connectToDB();

      $strXML = "<chart palette='2' caption='Factory Output ' subcaption='(In Units)' xAxisName='Date' showValues='1' labelStep='2' >";

  $strQuery = "SELECT count(o.product_id) as Total, p.product_short_desc, p.product_desc, o.product_id FROM products as p,  order_items as o WHERE p.product_type_id='3' AND p.product_id=o.product_id GROUP BY p.product_short_desc";
 $result = mysql_query($strQuery) or die(mysql_error());
    
 if ($result) {
  while($ors = mysql_fetch_array($result)) {
   
   $strXML .= "<set label='" . $ors['product_short_desc'] . "' value='" . $ors['Total'] . "' />";
  
     }
 }
 
 mysql_close($link);

 //Finally, close <graph> element
  $strXML .= "</chart>";
 
 //Create the chart  with data from $strXML
 echo renderChart("FusionCharts/FCF_Bar2D.swf", "", $strXML, "FactoryDetailed", 600, 300, false, false);
 
?>

Post #5691
Posted 4/16/2008 9:15:25 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Yesterday @ 2:58:00 AM
Posts: 811, Visits: 1,289
Hi,

Since you are using FREE  version of chart (FCF_Bar2D.swf), could you please try changing <chart> to <graph> , 'label' to 'name' and </chart> to </graph>; since these are the valid XML elements and attributes for vFREE charts.

On the contrary could you please use Bar2D.swf (v3 chart)?

Regards,

Sudipto Choudhury
FusionCharts Team

Post #5701
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 10:22pm


Execution: 0.078.