「PHP学習」FusionChartsで簡単グラフ描画をするサンプルコード
PHPコード
<?php
include (“head.php"); //htmlのheadが含まれる
include (“../FusionCharts/Includes/FusionCharts_Gen.php");
$FLASH_CHART_PATH = “../FusionCharts/Charts/";
?>
<script language="javascript">
</script>
<?php
$arrCatNames1[0] = “Product A";
$arrCatNames1[1] = “Product B";
$arrCatNames1[2] = “Product C";
//Store sales data for current year
//[x][0] シリーズ
//[x][2] データ
$arrData1[0][0] = “Current Year";
$arrData1[0][1] = “"; // Dataset Parameters
$arrData1[0][2] = 567;
$arrData1[0][3] = 815;
$arrData1[0][4] = 556;
//Store sales data for previous year
$arrData1[1][0] = “Previous Year";
$arrData1[1][1] = “"; // Dataset Parameter
$arrData1[1][2] = 547;
$arrData1[1][3] = 584;
$arrData1[1][4] = 754;
//Store sales data for the year before previous year
$arrData1[2][0] = “Early Year";
$arrData1[2][1] = “"; // Dataset Parameter
$arrData1[2][2] = 557;
$arrData1[2][3] = 537;
$arrData1[2][4] = 527;
# Create FusionCharts PHP Class object for multiseies column3d chart
$FC1 = new FusionCharts(“MSColumn3D","600″,"300″);
# Set Relative Path of swf file.
$FC1->setSwfPath(“../FusionCharts/Charts/");
# Store chart attributes in a variable
$strParam="caption=Sales by Product;numberPrefix=$;formatNumberScale=1;rotateValues=1;decimalPrecision=0″;
# Set chart attributes
$FC1->setChartParams($strParam);
# Pass the 2 arrays storing data and category names to
# FusionCharts PHP Class function addChartDataFromArray
$FC1->addChartDataFromArray($arrData1, $arrCatNames1);
# Render the Chart
$FC1->renderChart();
?>
<?php
include (“foot.php"); //htmlのfoot
?>
HP公式
http://www.fusioncharts.com/demos/business/#management-dashboard
http://www.fusioncharts.com/demos/business/management-dashboard/view/