954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Fusion chart with php

hi...i've research fusion chart... and i find it nice ..

I would like to retrieve from my database(SQL) and graph it using php

is there anybody here experience working with fusion chart and php?...

uselessninja
Junior Poster
115 posts since Jun 2010
Reputation Points: 10
Solved Threads: 1
 

According to the documentation you have to provide the data in XML or JSON format.

pritaeas
Posting Expert
Moderator
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 
According to the documentation you have to provide the data in XML or JSON format.


yeah i read it :D .... im currently working with SQL-php- fusionchart and i use odbc connection ... im learning xml about 2 days ago and im hoping someone experience odbc with fusion chart and help me just only a basic of it..

uselessninja
Junior Poster
115 posts since Jun 2010
Reputation Points: 10
Solved Threads: 1
 

this is my code with odbc ...there's something wrong with it (it will not display the chart)...

<?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");

?>
<HTML>
   <HEAD>
      <TITLE>FusionCharts Free - Database Example</TITLE>
      <SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
   </HEAD>
   <BODY>
   <CENTER>
   <?php   
  
$conn=odbc_connect('datasourcegaby','','');



$firststring= "Select POWER_GEN_1_VAL0,POWER_GEN_2_VAL0 from generators";

 
$rs=odbc_exec($conn,$firststring);

 $conn = connectToDB();


$strXML = "<graph caption='Sales' subCaption='of the month' decimalPrecision='0' showNames='1' numberSuffix=' Units' pieSliceDepth='30' formatNumberScale='0'>";



while (odbc_fetch_row($rs))

{

$g1=odbc_result($rs,"POWER_GEN_1_VAL0");

$g2=odbc_result($rs,"POWER_GEN_2_VAL0");

$strXML .= "<set name='POWER_GEN_1_VAL0' value='".$rs['POWER_GEN_1_VAL0']."' />";
$strXML .= "<set name='POWER_GEN_2_VAL0' value='".$rs['POWER_GEN_2_VAL0']."' />";

}

$strXML .= "</graph>";



//Create the chart - Column 3D Chart with data from strXML variable using dataXML method

echo renderChartHTML("./Charts/FCF_Bar2D.swf", "", $strXML, "ad", 800, 600, false);

?> 

</BODY>
</HTML>


table name:generators

column name1: POWER_GEN_1_VAL0
column name2: POWER_GEN_2_VAL0

uselessninja
Junior Poster
115 posts since Jun 2010
Reputation Points: 10
Solved Threads: 1
 

ohhh... i got it! ..


this is where i stuck...

echo renderChartHTML("./Charts/FCF_Bar2D.swf", "", $strXML, "ad", 800, 600, false);

it must be:
echo renderChartHTML("./MyFolderHere/FCF_Bar2D.swf", "", $strXML, "ad", 800, 600, false);

uselessninja
Junior Poster
115 posts since Jun 2010
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: