อยากได้โค๊ด การทำกราฟวงกลม และ กราฟเส้น ช่วยหน่อยครับ

จะดึงฐานข้อมูลมาจากดาต้าเเบส เอาตัวเลขมาแสดง เป็น กราฟ วงกลม  กราฟ แท่ง และ กราฟเส้น
ใครรุ้รบกวน ช้วยหน่อยครับ
15 ก.ค. 2553 2 5,383

ผมแนะนำครับ FusionCharts หาตัวทดลองใช้ครับ จะมีตัวอย่างให้หมดครับ ผมก็ใช้แล้ว สวยด้วยครับ
#1

โค๊ด การใช้ประมาณนี้ครับ ต่เมือโหลดมาแล้ว ก็จะมีตัวอย่างอยู่ในนั้นหมดเลยครับ

<?php
//We've included ../Includes/FusionCharts.php and ../Includes/DBConn.php, which contains
//functions to help us easily embed the charts and connect to a database.

include("../Includes/FusionCharts.php");
include("../Includes/DBConn.php");
?>
<HTML>
   <HEAD>
      <TITLE>FusionCharts Free - Database Example</TITLE>
      <SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
   </HEAD>
   <BODY>
   <CENTER>
   <?php   
   //In this example, we show how to connect FusionCharts to a database.
   //For the sake of ease, we've used a MySQL database containing two
   //tables.

   //Connect to the DB

   $link = connectToDB();

   //$strXML will be used to store the entire XML document generated
   //Generate the graph element

   $strXML = "<graph caption='Factory Output report' subCaption='By Quantity' decimalPrecision='0' showNames='1' numberSuffix=' Units' pieSliceDepth='30' formatNumberScale='0'>";

   //Fetch all factory records
   $strQuery = "select * from Factory_Master";
   $result = mysql_query($strQuery) or die(mysql_error());

   //Iterate through each factory
   if ($result) {
      while($ors = mysql_fetch_array($result)) {
         //Now create a second query to get details for this factory
         $strQuery = "select sum(Quantity) as TotOutput from Factory_Output where FactoryId=" . $ors['FactoryId'];
         $result2 = mysql_query($strQuery) or die(mysql_error());
         $ors2 = mysql_fetch_array($result2);
         //Generate <set name='..' value='..'/>
         $strXML .= "<set name='" . $ors['FactoryName'] . "' value='" . $ors2['TotOutput'] . "' />";
         //free the resultset
         mysql_free_result($result2);
      }
   }
   mysql_close($link);

   //Finally, close <graph> element
   $strXML .= "</graph>";

   //Create the chart - Pie 3D Chart with data from $strXML
   echo renderChart("../../FusionCharts/FCF_Pie3D.swf", "", $strXML, "FactorySum", 650, 450);
?>
</BODY>
</HTML>

#2
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^