本文整理汇总了PHP中FusionCharts::addChartDataFromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP FusionCharts::addChartDataFromArray方法的具体用法?PHP FusionCharts::addChartDataFromArray怎么用?PHP FusionCharts::addChartDataFromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FusionCharts
的用法示例。
在下文中一共展示了FusionCharts::addChartDataFromArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FusionCharts
$arrData[2][0] = "Product C";
$arrData[3][0] = "Product D";
$arrData[4][0] = "Product E";
$arrData[5][0] = "Product F";
//Store sales data
$arrData[0][1] = 567500;
$arrData[1][1] = 815300;
$arrData[2][1] = 556800;
$arrData[3][1] = 734500;
$arrData[4][1] = 676800;
$arrData[5][1] = 648500;
# Create FusionCharts PHP Class object for single series column3d chart
$FC = new FusionCharts("Column3D", "600", "300");
# Set Relative Path of swf file.
$FC->setSwfPath("../../FusionCharts/");
# store chart attributes in a variable
$strParam = "caption=Sales by Product;numberPrefix=\$;formatNumberScale=0;decimalPrecision=0";
# Set chart attributes
$FC->setChartParams($strParam);
## call FusionCharts PHP Class Function to add data from the array
$FC->addChartDataFromArray($arrData);
# Render the chart
$FC->renderChart();
?>
<BR><BR>
<a href='../NoChart.html' target="_blank">Unable to see the chart above?</a>
<H5 ><a href='../default.htm'>« Back to list of examples</a></h5>
</CENTER>
</BODY>
</HTML>
示例2: FusionCharts
//Store sales data for previous year
$arrData[1][0] = "Previous Year";
$arrData[1][1] = "";
// Dataset Parameter
$arrData[1][2] = 547300;
$arrData[1][3] = 584500;
$arrData[1][4] = 754000;
$arrData[1][5] = 456300;
$arrData[1][6] = 754500;
$arrData[1][7] = 437600;
# Create FusionCharts PHP Class object for multiseies column3d chart
$FC = new FusionCharts("MSColumn3D", "600", "300");
# Set Relative Path of swf file.
$FC->setSWFPath("../../FusionCharts/");
# Define chart attributes
$strParam = "caption=Sales by Product;numberPrefix=\$;formatNumberScale=1;rotateValues=1;decimals=0";
# Set chart attributes
$FC->setChartParams($strParam);
# Pass the 2 arrays storing data and category names to
# FusionCharts PHP Class function addChartDataFromArray
$FC->addChartDataFromArray($arrData, $arrCatNames);
# Render the Chart
$FC->renderChart();
?>
<BR><BR>
<a href='../NoChart.html' target="_blank">Unable to see the chart above?</a>
<H5 ><a href='../default.htm'>« Back to list of examples</a></h5>
</CENTER>
</BODY>
</HTML>
示例3: FusionCharts
$arrData[0][3] = 448000;
$arrData[0][4] = 956000;
$arrData[0][5] = 734000;
//Store Quantity Data
$arrData[1][0] = "Quantity";
$arrData[1][1] = "parentYAxis=S";
// Dataset Parameters
$arrData[1][2] = 576;
$arrData[1][3] = 448;
$arrData[1][4] = 956;
$arrData[1][5] = 734;
# Create combination chart object
$FC = new FusionCharts("MSColumn3DLineDY", "600", "300");
# Set Relative Path of swf file.
$FC->setSWFPath("../../FusionCharts/");
# Define chart attributes
$strParam = "caption=Product A - Sales Details;PYAxisName=Revenue;SYAxisName=Quantity (in Units);numberPrefix=\$;sNumberSuffix= unit";
# Set chart attributes
$FC->setChartParams($strParam);
# Pass the 2 arrays storing data and category names to
# FusionCharts PHP Class function addChartDataFromArray
$FC->addChartDataFromArray($arrData, $arrDataCat);
# Render the chart
$FC->renderChart();
?>
<BR><BR>
<a href='../NoChart.html' target="_blank">Unable to see the chart above?</a>
<H5 ><a href='../default.htm'>« Back to list of examples</a></h5>
</CENTER>
</BODY>
</HTML>
示例4: generateXML
/**
* Function generates an xml file for generating the chart
*
* @param string $sql
* @param array $strParam
*
* @return xml
*/
function generateXML($sql, $strParam)
{
include "../includes/FusionCharts_Gen.php";
$FC = new FusionCharts("Column3D", "900", "500");
$FC->setChartParams($strParam);
//$FC->AddColors("FF0000;00FF00;0000FF;FFFF00;FF00FF;FCAAAA");
$obj = new Bin_Query();
$arrdata = array();
if ($obj->executeQuery($sql)) {
$arr = $obj->records;
for ($i = 0; $i < count($arr); $i++) {
$arrdata[$i][0] = $arr[$i]['date'];
$arrdata[$i][1] = $arr[$i]['total'];
}
$FC->addChartDataFromArray($arrdata);
}
header('Content-type: text/xml');
$xml = $FC->getXML();
header('Content-type: text/html');
return $xml;
}