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?...

Recommended Answers

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

Jump to Post

All 5 Replies

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..

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

//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.

      <TITLE>FusionCharts Free - Database Example</TITLE>
      <SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>

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


 $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))




$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);



table name:generators

column name1: POWER_GEN_1_VAL0
column name2: POWER_GEN_2_VAL0

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

I am getting error as:
include(includes/fusioncharts.php): failed to open stream: No such file or directory in C:\xampp\htdocs\ghi.php on line 5

My code is :

<script type="text/javascript" src="/path/to/fusioncharts.js"></script> <script type="text/javascript" src="/path/to/themes/fusioncharts.theme.ocean.js"></script> <?php

$columnChart = new FusionCharts("column2d", "ex1" , 600, 400, "chart-1", "json", '{  
          "caption":"Harry SuperMart",
          "subCaption":"Top 5 stores in last month by revenue",
             "label":"Bakersfield Central",
             "label":"Garden Groove harbour",
             "label":"Los Angeles Topanga",
             "label":"Compton-Rancho Dom",
             "label":"Daly City Serramonte",
    // Render the chart
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.