Example #1
0
# Create a column 3d chart object
$FC = new FusionCharts("Column2D", "600", "300");
# Set Relative Path of swf file.
$FC->setSwfPath("../../FusionCharts/");
// Store Chart attributes in a variable
$strParam = "caption={$FactoryName} Output;subcaption=(In Units);xAxisName=Date; formatNumberScale=0;decimalPrecision=0;rotateNames=1;showValues=0";
#  Set chart attributes
$FC->setChartParams($strParam);
// Connet to the DataBase
$link = connectToDB();
//Now, we get the data for that factory
//storing chart values in 'Quantity' column and category names in 'DDate'
$strQuery = "select Quantity, DATE_FORMAT(DatePro,'%e-%b-%Y') as DDate from Factory_Output where FactoryId=" . $FactoryId;
$result = mysql_query($strQuery) or die(mysql_error());
//Pass the SQL query result to the FusionCharts PHP Class' function
//that will extract data from database and add to the chart.
if ($result) {
    $FC->addDataFromDatabase($result, "Quantity", "DDate");
}
mysql_close($link);
//Create the chart
$FC->renderChart();
?>
<BR>
<a href='Default.php'>Back to Summary</a>
<BR><BR>
<a href='../NoChart.html' target="_blank">Unable to see the chart above?</a>
<H5 ><a href='../default.htm'>&laquo; Back to list of examples</a></h5>
</CENTER>
</BODY>
</HTML>
Example #2
0
include "../Includes/FusionCharts_Gen.php";
//This page generates the XML data for the Pie Chart contained in
//Default.php.
//For the sake of ease, we've used an MySQL databases containing two
//tables..
//Connect to the Database
$link = connectToDB();
# Create a pie 3d chart object
$FC = new FusionCharts("Pie3D", "650", "450");
# Set Relative Path of swf file.
$FC->setSWFPath("../../FusionCharts/");
# Define chart attributes
$strParam = "caption=Factory Output report;subCaption=By Quantity;pieSliceDepth=30;showBorder=1;numberSuffix= Units";
#Set chart attributes
$FC->setChartParams($strParam);
// Fetch all factory records usins SQL Query
//Store chart data values in 'total' column/field and category names in 'FactoryName'
$strQuery = "select a.FactoryID, b.FactoryName, sum(a.Quantity) as total from Factory_output a, Factory_Master b where a.FactoryId=b.FactoryId group by a.FactoryId,b.FactoryName";
$result = mysql_query($strQuery) or die(mysql_error());
//Pass the SQL Query result to the FusionCharts PHP Class function
//along with field/column names that are storing chart values and corresponding category names
//to set chart data from database
if ($result) {
    $FC->addDataFromDatabase($result, "total", "FactoryName");
}
mysql_close($link);
//Set Proper output content-type
header('Content-type: text/xml');
//Just write out the XML data
//NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVER
print $FC->getXML();
# Create column 2d chart object
$FC = new FusionCharts("Column2D", "500", "400");
# Set Chart attributes
$FC->setChartParams("caption=Monthly Sales Summary;subcaption=For the year 2008;");
$FC->setChartParams("xAxisName=Month;yAxisName=Sales;numberPrefix=\$;showNames=1;");
$FC->setChartParams("showValues=0;showColumnShadow=1;animation=1;");
$FC->setChartParams("baseFontColor=666666;lineColor=FF5904;lineAlpha=85;");
$FC->setChartParams("valuePadding=10;labelDisplay=rotate;useRoundEdges=1");
//Connect to the DB
$link = connectToDB('sales');
// Fetch all factory records
$strQuery = "select * from monthly_utf8";
$result = mysql_query($strQuery) or die(mysql_error());
//Pass the SQL Query result to the FusionCharts PHP Class function
//along with field/column names that are storing chart values and corresponding category names
//to set chart data from database
if ($result) {
    $FC->addDataFromDatabase($result, "amount", "month_name");
}
//free the resultset
mysql_free_result($result);
// close database
mysql_close($link);
# define and apply style
$FC->defineStyle("myCaptionFont", "Font", "size=12");
$FC->applyStyle("DATALABELS", "myCaptionFont");
//Set Proper output content-type
header('Content-type: text/xml');
//Just write out the XML data
//NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVER
print $FC->getXML();
Example #4
0
<?php

/**
 * Created by PhpStorm.
 * User: Allan Wiz
 * Date: 4/17/15
 * Time: 4:48 PM
 */
include '../classes/aardb_conn.php';
include '../charts/JSClass/FusionCharts_Gen.php';
global $session, $database;
global $conn;
$FC = new FusionCharts("FC_Line.swf", "900", "450");
$FC->setDataBaseType("Oracle");
$FC->setSwfPath("../Charts/");
$strParam = "caption=INTEREST VIEW REPORT (for the last 14 days);subCaption=BY APPLICABLE DATE ; showNames='1';pieSliceDepth=30;showBorder=1;numberSuffix= %; formatNumberScale='0'; xAxisName=Date; pYAxisName=Net Asset Value;sYAxisName=BalancedFund";
$FC->setChartParams($strParam);
$start = date("d/M/Y", strtotime('-50 days'));
$today = date("d/M/Y");
$sql = "SELECT I_RATES.RATE_ID, I_RATES.RATE_DATE AS DATEY, I_RATES.RATE AS RATE, SECURITIES.DESCRIPT AS DESCRIPTION FROM I_RATES INNER JOIN\r        SECURITIES ON I_RATES.SECURITY_CODE = SECURITIES.SECURITY_CODE WHERE I_RATES.CONFIRMD = 1 AND I_RATES.RATE_DATE  BETWEEN '{$start}' AND '{$today}' ORDER BY I_RATES.RATE_DATE";
$result = oci_parse($conn, $sql) or die("");
oci_execute($result);
if ($result) {
    //$FC->addCategoryFromDatabase($result,"DESCRIPTION");
    $FC->addDataFromDatabase($result, "RATE", "DATEY");
}
print $FC->getXML();
Example #5
0
$FC->setChartParams($strParam);
# Fetch all factory records creating SQL query
$strQuery = "select a.FactoryID, b.FactoryName, sum(a.Quantity) as total from Factory_output a, Factory_Master b where a.FactoryId=b.FactoryId group by a.FactoryId,b.FactoryName";
$result = mysql_query($strQuery) or die(mysql_error());
#Pass the SQL query result and Drill-Down link format to PHP Class Function
# this function will automatically add chart data from database
/*
 The last parameter passed i.e. "Detailed.php?FactoryId=##FactoryID##"
 drill down link from the current chart
 Here, the link redirects to another PHP file Detailed.php 
 with a query string variable -FactoryId
 whose value would be taken from the Query result created above.
 Any thing placed between ## and ## will be regarded 
 as a field/column name in the SQL query result.
 value from that column will be assingned as the query variable's value
 Hence, for each dataplot in the chart the resultant query variable's value
 will be different
*/
if ($result) {
    $FC->addDataFromDatabase($result, "total", "FactoryName", "", "Detailed.php?FactoryId=##FactoryID##");
}
mysql_close($link);
# Create the chart
$FC->renderChart();
?>
<BR><BR>
<a href='../NoChart.html' target="_blank">Unable to see the chart above?</a>
<H5 ><a href='../default.htm'>&laquo; Back to list of examples</a></h5>
</CENTER>
</BODY>
</HTML>
Example #6
0
	# Set Relative Path of swf file.
 	$FC->setSwfPath("../../FusionCharts/");
	   
	// Store Chart attributes in a variable
	$strParam="caption=Industrie rapport de la production;subCaption=par quantité; decimalPrecision=0;showNames=1;numberSuffix= Units;pieSliceDepth=30";
	
	#  Set chart attributes
 	$FC->setChartParams($strParam);
	
    // Fetch all factory records
    $strQuery = "select a.FactoryId, a.FactoryName, sum(b.Quantity) as TotOutput from French_Factory_Master a,Factory_Output b where a.FactoryId=b.FactoryId group by a.FactoryId, a.FactoryName";
    $result = mysql_query($strQuery) or die(mysql_error());
    
    //Iterate through each factory
    if ($result) {
       // Convert Result set to FusionCharts Data     
       $FC->addDataFromDatabase($result, "TotOutput", "FactoryName");
 
    }
    //free the resultset
	mysql_free_result($result);
    mysql_close($link);

	
    //Set Proper output content-type and charset
    header('Content-type: text/xml;charset=UTF-8');
	
    //Just write out the XML data
    //NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVER
?>
<?xml version='1.0' encoding='UTF-8'?><?php  echo $FC->getXML(); ?>
Example #7
0
<?php

include '../classes/aardb_conn.php';
include '../charts/JSClass/FusionCharts_Gen.php';
global $session, $database;
global $conn;
$FC = new FusionCharts("300", "350");
$FC->setDataBaseType("Oracle");
$FC->setSwfPath("../Charts/");
$strParam = "caption=NET ASSET VALUE REPORT;subCaption=BY DATE; showNames='1';pieSliceDepth=30;showBorder=1;numberSuffix= NAV; formatNumberScale='0'; xAxisName=Date; yAxisName=Net Asset Value";
$FC->setChartParams($strParam);
$start = date("d/M/Y", strtotime('-7 days'));
$today = date("d/M/Y");
$sql = "SELECT  NAVS.NAV_ID,  NAVS.NAV_DATE as NAV_DATE, NAVS.SECURITY_CODE, NAVS.AMOUNT as AMOUNT,    SECURITIES.DESCRIPT as DESCRIPTION\r        FROM    NAVS     INNER JOIN SECURITIES ON NAVS.SECURITY_CODE = SECURITIES.SECURITY_CODE\r        WHERE   NAVS.CONFIRMD = 1 AND NAVS.NAV_DATE BETWEEN '{$start}' AND '{$today}' ORDER BY     NAVS.NAV_DATE ASC";
$result = oci_parse($conn, $sql) or die("");
oci_execute($result);
if ($result) {
    $FC->addDataFromDatabase($result, "AMOUNT", "NAV_DATE");
}
print $FC->getXML();