CJL999 Report post Posted February 4, 2007 Hi there, I'm new using FusionCharts with mysql database. I've seen an example on the document but I still confuse fetching data from mysql to the chart. Can anyone give me some basic database example using php+mysql? I just want to learn how to plot a simple pie chart or bar chart with couple of data. best regards. Share this post Link to post Share on other sites
Pallav Report post Posted February 5, 2007 You may please see http://www.fusioncharts.com/FusionCharts/Docs > Guide for Web Developers > FusionCharts and PHP. We've lot of simple and easy-to-grasp examples with documentation. Share this post Link to post Share on other sites
CJL999 Report post Posted February 5, 2007 That's why I ask for more simple examples the existed on document is too complicated for me :crying: PLEASE show me some SIMPLE-1-table database chart plotting. Share this post Link to post Share on other sites
Pallav Report post Posted February 6, 2007 You can see the Array or Form examples. Those are simple examples. I'm afraid we do NOT have anything simpler than that. Share this post Link to post Share on other sites
b471code3 Report post Posted June 25, 2007 Here are a sample of code I have written to get my charts to populate.This is a simple 2D pie chart with v3 charts. There are two seperate files, one is a data file and the other displays the chart and other html items on the viewable page. What this code is from is the data file. Hope it helps you out. <?php session_start(); // used to start a session for security reasons include ('login.php'); // security files include ('names.php'); //misc files include './includes/Connection_'.$conn.'.php'; // connection file with functions include './includes/chart_colors.php'; // get the variables posted in the page form; prepend 'r_' to them import_request_variables("gp", "r_"); $date = date("m/d/y"); // get the customer data // query the MySQL database $query = "SELECT SUM((qty_ord - qty_ship) * line_price) as sales, reason_code, reason_group, reason_name FROM sales_late_orders WHERE closed = 'no' GROUP BY reason_group, reason_name"; // result of the query $result = db_query($query, $DBLink) or die ('Error: Cannot get Data!'); // generate the XML for the chart $strXML = "<graph caption='Late Orders by Reason ".$date."' useRoundEdges='1' chartLeftMargin='0' chartRightMargin='5' chartTopMargin='0' chartBottomMargin='0' decimalPrecision='0' showPercentageValues='0' showNames='1' rotateNames='1' numberPrefix='".$symbol."' showPercentageInLabel='0' canvasBgColor='FFFFFF,".$_GET["daColor"]."' canvasBgAngle='270' canvasBgAlpha='90' bgColor='".$strColor[10]."' showAlternateHGridColor='0' showBorder='0' baseFontSize='12' baseFontColor='".$strColor[8]."'>"; // connection settings for other servers if ($hostname == "192.168.5.50") { switch ($cCo) { case "csgc": $file = "csgc/"; break; case "ucl": $file = "csgw/"; break; } } // as long as there is a result in the row (function called out in the connection file) it will keep doing the loop while ($row = db_fetch_assoc($result)){ // append the data if ($row["reason_code"] == 0){ $reason = "Unassigned"; } else { if ($row["reason_group"] == $row["reason_name"]) { $reason = $row["reason_group"]; } else { $reason = $row["reason_group"]." - ".$row["reason_name"]; } } $htmlLink = "[url][u]http://".$hostname."/cgi-bin/wspd_cgi.sh/WService=ws".$broker."/dash/".$file."reason1.html?cReason=".$row["reason_code"][/u][/url]; $strXML = $strXML."<set value='".$row["sales"]."' name='".$reason."' link='".$htmlLink."' />"; } // close tags // concatenate to form the whole XML document $strXML = $strXML; $strXML = $strXML."</graph>"; // output the data echo($strXML); ?> Share this post Link to post Share on other sites