本文整理汇总了PHP中FusionCharts类的典型用法代码示例。如果您正苦于以下问题:PHP FusionCharts类的具体用法?PHP FusionCharts怎么用?PHP FusionCharts使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FusionCharts类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FusionCharts
function FusionCharts($chart_type = '', $width = "300", $height = "250")
{
require_once 'fusion/FusionCharts_Gen.php';
$FC = new FusionCharts($chart_type, $width, $height);
$FC->setSWFPath(base_url() . "chart/");
return $FC;
}
示例2: mychart
function mychart()
{
//$this->load->libraries('fusion_pi');
$arrData = array();
$FC = new FusionCharts("Column3D", "720", "400");
/*$arrData = array( 500, 269, 254, 895, 633);
foreach( $arrData as $i=>$data ){
$FC->addChartData( $data );
} */
//$sql="select count(distinct(nama_spb)) as nama_spb,month(tgl_spb) as bln from spb group by concat(month(tgl_spb),year(tgl_spb))";
//echo $sql;
$FC->setDataURL("graph.xml");
$strParam = "numberSuffix=; formatNumberScale=0; decimalPrecision=0; xAxisName=Bulan; animation=1";
$FC->setChartParams($strParam);
$FC->setChartMessage("ChartNoDataText=Chart Data not provided; PBarLoadingText=Please Wait.The chart is loading...");
return $FC->renderChart(false, false);
}
示例3: makeBar
function makeBar($val, $IDSuffix)
{
//---------- Creating First Chart ----------------------------------------------
# Create FusionCharts PHP object
$FC = new FusionCharts("Column3D", "300", "250", "myChartId" . $IDSuffix);
# set the relative path of the swf file
$FC->setSWFPath("../../FusionCharts/");
# Define chart attributes# Set chart attributes
$strParam = "caption=Weekly Sales;subcaption={$val};xAxisName=Week;yAxisName=Revenue;numberPrefix=\$";
# Setting chart attributes
$FC->setChartParams($strParam);
# add chart values and category names for the First Chart
$FC->addChartData("40800", "Label=Week 1");
$FC->addChartData("31400", "Label=Week 2");
$FC->addChartData("26700", "Label=Week 3");
$FC->addChartData("54400", "Label=Week 4");
//-------------------------------------------------------------------
$FC->renderChart();
}
示例4: sum
$start = $_POST["start"];
$end = $_POST["end"];
if (strtotime($end) < strtotime($start)) {
echo "Tanggal tidak valid";
} else {
$per_periode = "SELECT nama_barang, sum(n_pakai) as 'jumlah pemakaian' FROM t_pemakaian WHERE tanggal<='" . $end . "' and tanggal>='" . $start . "' GROUP BY kode_barang";
$result = $conn->query($per_periode);
echo "<br>";
if ($result->num_rows > 0) {
include "fusioncharts.php";
$arrData = array("chart" => array("caption" => "Pemakaian ATK dari periode " . $start . " sampai " . $end, "xAxisName" => "Nama Barang", "yAxisName" => "Jumlah Pemakaian (pcs)"));
$arrData["data"] = array();
while ($row = mysqli_fetch_array($result)) {
array_push($arrData["data"], array("label" => $row["nama_barang"], "value" => $row["jumlah pemakaian"]));
}
$chart = new FusionCharts("column2D", "periodChart", 600, 400, "chart-1", "json", json_encode($arrData));
$chart->render();
?>
<div id="chart-1"></div>
<?php
} else {
echo "tidak ada hasil";
}
}
}
}
}
}
$conn->close();
?>
</div>
示例5: FusionCharts
-->
</style>
</HEAD>
<BODY>
<CENTER>
<h2>FusionCharts Examples</h2>
<h4>Example using XML having multilingual text</h4>
<?php
//This page demonstrates the ease of generating charts containing UTF-8 encoded
//multilingual text using FusionCharts PHPClass.
//For this chart, we've cread a chart object used FusionCharts PHP Class
//supply chart data and configurations to it and render chart using the instance
//Here, we've kept this example very simple.
# Create column 2d chart object
$FC = new FusionCharts("Column2D", "500", "400");
# Set Relative Path of swf file.
$FC->setSWFPath("../../FusionCharts/");
# 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");
#add chart data values and category names
$FC->addChartData("17400", "Label=januári");
$FC->addChartData("19800", "Label=Fevruários");
$FC->addChartData("21800", "Label=مارس");
$FC->addChartData("23800", "Label=أبريل");
$FC->addChartData("29600", "Label=五月");
$FC->addChartData("27600", "Label=六月");
示例6: FusionCharts
<?php
# Include FusionCharts PHP Class
include "../Class/FusionCharts_Gen.php";
# Create Column2D chart Object
$FC = new FusionCharts("column2D", "300", "250");
# set the relative path of the swf file
$FC->setSWFPath("../FusionCharts/");
# Define chart attributes
$strParam = "caption=Weekly Sales;xAxisName=Week;yAxisName=Revenue;numberPrefix=\$";
# Set chart attributes
$FC->setChartParams($strParam);
# add chart values and category names
$FC->addChartData("40800", "label=Week 1");
$FC->addChartData("31400", "label=Week 2");
$FC->addChartData("26700", "label=Week 3");
$FC->addChartData("54400", "label=Week 4");
# Add First TrendLine
$FC->addTrendLine("startValue=42000;color=ff0000");
# Add Second TrendLine
$FC->addTrendLine("startValue=30000;color=008800;displayvalue=Average;showOnTop=1");
# Add TrendZone
$FC->addTrendLine("startValue=50000;endValue=60000;color=0000ff;alpha=20;displayvalue=Dream Sales;showOnTop=1;isTrendZone=1");
?>
<html>
<head>
<title>First Chart - Advanced - Add Trendlines : Using FusionCharts PHP Class</title>
<script language='javascript' src='../FusionCharts/FusionCharts.js'></script>
</head>
<body>
示例7: FusionCharts
<?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();
示例8: array
// If the query returns a valid response, prepare the JSON string
if ($result) {
// The `$arrData` array holds the chart attributes and data
$arrData = array("chart" => array("caption" => "Cereal Crop Index", "paletteColors" => "#0075c2", "bgColor" => "#ffffff", "borderAlpha" => "20", "canvasBorderAlpha" => "0", "usePlotGradientColor" => "0", "plotBorderAlpha" => "10", "showXAxisLine" => "1", "xAxisLineColor" => "#999999", "showValues" => "0", "divlineColor" => "#999999", "divLineIsDashed" => "1", "showAlternateHGridColor" => "0"));
$arrData["data"] = array();
// Push the data into the array
while ($row = mysqli_fetch_array($result)) {
array_push($arrData["data"], array("label" => $row["district_name"], "value" => $row["cerial_index"]));
}
/*JSON Encode the data to retrieve the string containing the JSON representation of the data in the array. */
$jsonEncodedData = json_encode($arrData);
/*Create an object for the column chart using the FusionCharts PHP class constructor. Syntax for the constructor is ` FusionCharts("type of chart", "unique chart id", width of the chart, height of the chart, "div id to render the chart", "data format", "data source")`. Because we are using JSON data to render the chart, the data format will be `json`. The variable `$jsonEncodeData` holds all the JSON data for the chart, and will be passed as the value for the data source parameter of the constructor.*/
$columnChart1 = new FusionCharts("Column3D", "myFirstChart1", 1000, 500, "chart-1", "json", $jsonEncodedData);
$columnChart2 = new FusionCharts("Pie3D", "myFirstChart2", 1000, 500, "chart-2", "json", $jsonEncodedData);
$columnChart3 = new FusionCharts("line", "myFirstChart3", 1000, 500, "chart-3", "json", $jsonEncodedData);
$columnChart4 = new FusionCharts("area2D", "myFirstChart4", 1000, 500, "chart-4", "json", $jsonEncodedData);
// Render the chart
$columnChart1->render();
$columnChart2->render();
$columnChart3->render();
$columnChart4->render();
// Close the database connection
$dbhandle->close();
}
?>
<div id="chart-1"><!-- Fusion Charts will render here--></div>
<div id="chart-2"><!-- Fusion Charts will render here--></div>
<div id="chart-3"><!-- Fusion Charts will render here--></div>
<div id="chart-4"><!-- Fusion Charts will render here--></div>
</body>
示例9: connectToDB
</style>
</HEAD>
<BODY>
<CENTER>
<h2><a href="http://www.fusioncharts.com" target="_blank">FusionCharts Free</a> -Database and Drill-Down Example</h2>
<?php
//In this example, we show how to connect FusionCharts to a database.
//For the sake of ease, we've used an MySQL databases containing two
//tables.
// Connect to the Database
$link = connectToDB();
# Create pie 3d chart object using FusionCharts PHP Class
$FC = new FusionCharts("Pie3D", "650", "450");
# Set Relative Path of swf file.
$FC->setSwfPath("../../FusionCharts/");
//Store chart attributes in a variable for ease of use
$strParam = "caption=Factory Output report;subCaption=By Quantity;pieSliceDepth=30; showBorder=1;showNames=1;formatNumberScale=0;numberSuffix= Units;decimalPrecision=0";
# 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");
示例10: connectToDB
<?php
//This page builds XML from database. The database contains UTF-8 encoded multilingual text.
//We have pre encoded this file as UTF-8 encoded with BOM
//Hence, we would just retrieve the text and relay it to the chart
//We've included ../../Includes/DBConn.php, which contains functions
//to help us easily connect to a database.
include "../../Includes/DBConn.php";
//We've included ../Includes/FusionCharts_Gen.php, which FusionCharts PHP Class
//to help us easily embed the charts.
include "../../Includes/FusionCharts_Gen.php";
//For the sake of ease, we've used an MySQL databases - sales and all data in a table - 'monthly_utf8'
//Connect to the Database
$link = connectToDB('sales');
# 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");
示例11: FusionCharts
</HEAD>
<BODY>
<CENTER>
<h2><a href="http://www.fusioncharts.com" target="_blank">FusionCharts Free</a> Examples</h2>
<h4>Simple Column 3D Chart</h4>
<p> </p>
<?php
//This page demonstrates the ease of generating charts using FusionCharts PHPClass.
//For this chart, we've cread a chart object used FusionCharts PHP Class
//supply chart data and configurations to it and render chart using the instance
//Here, we've kept this example very simple.
# Create column 3d chart object
$FC = new FusionCharts("Column3D", "600", "300");
# Set Relative Path of swf file.
$FC->setSwfPath("../../FusionCharts/");
# Store Chart attributes in a variable
$strParam = "caption=Monthly Unit Sales;xAxisName=Month;yAxisName=Units;decimalPrecision=0; formatNumberScale=0";
# Set Chart attributes
$FC->setChartParams($strParam);
#add chart data values and category names
$FC->addChartData("462", "name=Jan");
$FC->addChartData("857", "name=Feb");
$FC->addChartData("671", "name=Mar");
$FC->addChartData("494", "name=Apr");
$FC->addChartData("761", "name=May");
$FC->addChartData("960", "name=Jun");
$FC->addChartData("629", "name=Jul");
$FC->addChartData("622", "name=Aug");
示例12: FusionCharts
<?php
# Include FusionCharts PHP Class
include "../Class/FusionCharts_Gen.php";
# Create Column 3D + Line Dual Y-Axis Combination Chart
$FC = new FusionCharts("MSColumn3DLineDY", "450", "350");
# Set the relative path of the swf file
$FC->setSWFPath("../FusionCharts/");
# Store chart attributes in a variable
$strParam = "caption=Weekly Sales;subcaption=Comparison;xAxisName=Week;pYAxisName=Revenue;sYAxisName=Total Quantity;numberPrefix=\$;sNumberSuffix= U";
# Set chart attributes
$FC->setChartParams($strParam);
# Add category names
$FC->addCategory("Week 1");
$FC->addCategory("Week 2");
$FC->addCategory("Week 3");
$FC->addCategory("Week 4");
# Add a new dataset with dataset parameters
$FC->addDataset("This Month", "showValues=0");
# Add chart data for the above dataset
$FC->addChartData("40800");
$FC->addChartData("31400");
$FC->addChartData("26700");
$FC->addChartData("54400");
# Add aother dataset with dataset parameters
$FC->addDataset("Previous Month", "showValues=0");
# Add chart data for the second dataset
$FC->addChartData("38300");
$FC->addChartData("28400");
$FC->addChartData("15700");
$FC->addChartData("48100");
示例13: FusionCharts
<?php
# Include FusionCharts PHP Class
include '../Class/FusionCharts_Gen.php';
# Create SSGrid chart Object
$FC = new FusionCharts("grid", "300", "200");
# set the relative path of the swf file
$FC->setSWFPath("../FusionCharts/");
# Set grid value Percent on
$FC->setGridParams("showPercentValues=1");
# Set alternet row back ground color
$FC->setGridParams("alternateRowBgColor=EAECEF");
# number item per page
$FC->setGridParams("numberItemsPerPage=4");
# set grid font and font size
$FC->setGridParams("baseFont=vardana");
$FC->setGridParams("baseFontSize=12");
# Add grid values and category names
$FC->addChartData("40800", "label=Week 1");
$FC->addChartData("31400", "label=Week 2");
$FC->addChartData("26700", "label=Week 3");
$FC->addChartData("54400", "label=Week 4");
$FC->addChartData("88544", "label=Week 5");
$FC->addChartData("22544", "label=Week 6");
$FC->addChartData("65548", "label=Week 7");
?>
<html>
<head>
<title>SSGrid with PHP Class</title>
<script language='javascript' src='../FusionCharts/FusionCharts.js'></script>
</head>
示例14: distancia_sup
</style>
</head>
<body>
<?php
if (isset($_REQUEST["area_rep"])) {
?>
<script type="text/javascript">
$(document).ready(function(){
top = distancia_sup(document.getElementById("grafica"));
$("#ayuda").css("top",top)
});
</script>
<?php
$areas = $reporte->obtener_area($_REQUEST["area_rep"]);
$area = $areas[0];
$FC = new FusionCharts("Column3D", "720", "350");
$FC->setSWFPath("../../FusionCharts/");
$strParam = "caption=Productividad de Usuarios de " . $area["abreviatura"] . ";xAxisName=Usuario;yAxisName = Productividad (%)";
$FC->setChartParams($strParam);
?>
<form name="form_reporte" action="">
<table width="92%" border="0" align="center">
<?php
if ($_REQUEST["tipo"] != 1 && $_REQUEST["tipo"] != 2) {
?>
<tr id = "barra_botones">
<td> </td>
<td colspan="2"> </td>
<td colspan="5"> </td>
<td colspan="2"> </td>
<td> </td>
示例15: FusionCharts
<?php
# Include FusionCharts PHP Class
include "../Class/FusionCharts_Gen.php";
# Create Column3D chart Object
$FC = new FusionCharts("Column3D", "300", "250");
# set the relative path of the swf file
$FC->setSWFPath("../FusionCharts/");
# Define chart attributes
$strParam = "caption=Weekly Sales;xAxisName=Week;yAxisName=Revenue;numberPrefix=\$;decimals=0;formatNumberScale=0";
# Set chart attributes
$FC->setChartParams($strParam);
# Add chart values and category names
$FC->addChartData("40800", "label=Week 1;alpha=40;showLabel=0;showValue=0");
$FC->addChartData("31400", "label=Week 2;alpha=40;showLabel=0;showValue=0");
$FC->addChartData("26700", "label=Week 3;hoverText=Lowest;link=tooLow.php");
$FC->addChartData("54400", "label=Week 4;showLabel=0;showValue=0; alpha=40; toolText=Highest");
?>
<html>
<head>
<title>First Chart - Advanded - Set Other Elements : Using FusionCharts PHP Class</title>
<script language='javascript' src='../FusionCharts/FusionCharts.js'></script>
</head>
<body>
<?php
# Render Chart
$FC->renderChart();
?>
</body>