本文整理汇总了PHP中FusionCharts::renderChart方法的典型用法代码示例。如果您正苦于以下问题:PHP FusionCharts::renderChart方法的具体用法?PHP FusionCharts::renderChart怎么用?PHP FusionCharts::renderChart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FusionCharts
的用法示例。
在下文中一共展示了FusionCharts::renderChart方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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();
}
示例3:
$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>
<?php
# Render Chart
$FC->renderChart();
?>
</body>
</html>
示例4: FusionCharts
$FC->addChartData("40800", "name=Week 1");
$FC->addChartData("31400", "name=Week 2");
$FC->addChartData("26700", "name=Week 3");
$FC->addChartData("54400", "name=Week 4");
//-------------------------------------------------------------------
//----- Creating Second Chart ---------------------------------------
# Create FusionCharts PHP object
$FC2 = new FusionCharts("Column3D", "300", "250");
# set the relative path of the swf file
$FC2->setSWFPath("../../FusionCharts/");
# Setting chart attributes
$strParam = "caption=Weekly Sales;subcaption=Quantity;xAxisName=Week;yAxisName=Quantity;decimalPrecision=0";
$FC2->setChartParams($strParam);
# add chart values and category names for the second chart
$FC2->addChartData("32", "name=Week 1");
$FC2->addChartData("35", "name=Week 2");
$FC2->addChartData("26", "name=Week 3");
$FC2->addChartData("44", "name=Week 4");
//-------------------------------------------------------------------------
# Render First Chart
$FC->renderChart();
# Render Second Chart
$FC2->renderChart();
?>
<BR><BR>
<a href='../NoChart.html' target="_blank">Unable to see the charts above?</a>
<H5 ><a href='../default.htm'>« Back to list of examples</a></h5>
</CENTER>
</BODY>
</HTML>
示例5: renderChart
# 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");
?>
<html>
<head>
<title>Render as HTML Using FusionCharts PHP Class</title>
</head>
<body>
<?php
# Pass true to renderChart() function
# to use HTML Embedding Method.
# This is helpful if you wish not use FusionCharts.js
# or when rendering the chart using AJAX
$FC->renderChart(true);
?>
</body>
</html>
示例6: while
while ($count < $total + 1) {
$arrData[$basic][0] = $count;
$arrData[$basic][1] = $visitors[$count];
$count++;
$basic++;
if ($count < 10) {
$count = "0" . $count;
}
}
$FC = new FusionCharts("Column3D", "800", "300");
/*
set Relative Path of chart swf file.
*/
$FC->setSwfPath("../" . MODS_DIRECTORY . "/charts/");
/* store chart attributes in a variable. */
$strParam = "caption={$month} " . _("Statistics") . ";formatNumberScale=0;decimalPrecision=0";
/* set chart attributes. */
$FC->setChartParams($strParam);
$FC->addChartDataFromArray($arrData);
/* displaying the traffic chart by fetching the data directly from the analytics server. */
echo "<div>" . $FC->renderChart() . "</div>";
} else {
echo "<div class=\"alert alert-error\"><strong>" . _("Settings not configured.") . "</strong><br/>" . _("It seems that your Google analytics settings are not configured properly. Please configure them properly.") . "</div>";
}
} else {
echo "<div class=\"alert alert-error\"><strong>" . _("Unauthorized Access.") . "</strong><br/>" . _("You are not authorized to access this page.") . "</div>";
}
} else {
echo "<meta http-equiv=\"refresh\" content=\"0;url={$website}/" . USER_DIRECTORY . "/login\" />";
}
include "../" . USER_DIRECTORY . "/footer.php";
示例7: getChart
//.........这里部分代码省略.........
$milestone = $params->get('fusion_gantt_chart_milestone');
$milestoneraw = $milestone."_raw";
$connector = $params->get('fusion_gantt_chart_connector');
$connectorraw = $connector."_raw";
$fields = array();
$fields[] = FabrikString::safeColName($process)." AS " . $db->nameQuote($process);
$fields[] = FabrikString::safeColName($start)." AS " . $db->nameQuote($start);
$fields[] = FabrikString::safeColName($end)." AS " . $db->nameQuote($end);
$fields[] = FabrikString::safeColName($label)." AS " . $db->nameQuote($label);
if ($hover !== '') {
$fields[] = FabrikString::safeColName($hover)." AS " . $db->nameQuote($hover);
}
if ($milestone !== '') {
$fields[] = FabrikString::safeColName($milestone)." AS " . $db->nameQuote($milestone);
}
if ($connector !== '') {
$fields[] = FabrikString::safeColName($connector)." AS " . $db->nameQuote($connector);
}
$listModel->asfields = $fields;
$nav = $listModel->getPagination(0, 0, 0);
$data = $listModel->getData();
$data = $data[0];
$mindate = null;
$maxdate = null;
$usedProcesses = array();
$milestones = array();
$connectors = array();
$processLabel = $params->get('fusion_gantt_chart_process_label');
$FC->setGanttProcessesParams("positionInGrid=right;align=center;headerText=$processLabel;fontColor=333333;fontSize=11;isBold=1;isAnimated=1;bgColor=99cc00;headerbgColor=333333;headerFontColor=99cc00;headerFontSize=16;bgAlpha=40");
foreach ($data as $d) {
$hovertext = $hover == '' ? '' : $d->$hover;
$processid = $d->$processraw;
$startdate = JFactory::getDate($d->$startraw);
$enddate = JFactory::getDate($d->$endraw);
$strParam = "start=".$startdate->toFormat('%Y/%m/%d').";end=".$enddate->toFormat('%Y/%m/%d').";processId={$processid};id={$d->__pk_val};color=99cc00;alpha=60;topPadding=19;hoverText={$hovertext};";
$strParam .="link={$d->fabrik_view_url};";
$FC->addGanttTask($FC->encodeSpecialChars($d->$label), $strParam);
if ($milestone !== '' && $d->$milestoneraw == 1) {
$FC->addGanttMilestone($d->__pk_val, "date=".$enddate->toFormat('%Y/%m/%d').";radius=10;color=333333;shape=Star;numSides=5;borderThickness=1");
}
if ($connector !== '' && $d->$connectorraw !== '') {
$FC->addGanttConnector($d->$connectorraw, $d->__pk_val, "color=99cc00;thickness=2;");
}
#apply processes
if (!in_array($processid, $usedProcesses)) {
$usedProcesses[] = $processid;
$FC->addGanttProcess($FC->encodeSpecialChars($d->$process), "id={$processid};");
}
#increaes max/min date range
if (is_null($mindate)) {
$mindate = $startdate;
$maxdate = $enddate;
} else {
if (JFactory::getDate($d->$startraw)->toUnix() < $mindate->toUnix()) {
$mindate = JFactory::getDate($d->$startraw);
}
if (JFactory::getDate($d->$endraw)->toUnix() > $maxdate->toUnix()) {
$maxdate = JFactory::getDate($d->$endraw);
}
}
}
$startyear = $mindate ? $mindate->toFormat('%Y') : date('Y');
$endyear = $maxdate ? $maxdate->toFormat('%Y') : 0;
$monthdisplay = $params->get('fusion_gannt_chart_monthdisplay');
$FC->addGanttCategorySet("bgColor=333333;fontColor=99cc00;isBold=1;fontSize=14");
for ($y = $startyear; $y <= $endyear; $y++) {
$firstmonth = ($y == $startyear) ? (int)$mindate->toFormat('%m') : 1;
$lastmonth = ($y == $endyear) ? $maxdate->toFormat('%m')+1 : 13;
$start = date('Y/m/d', mktime(0, 0, 0, $firstmonth, 1, $y));
$end = date('Y/m/d', mktime(0, 0, 0, $lastmonth, 0, $y));
$strParam = "start=". $start.";end=".$end.";";
$FC->addGanttCategory($y, $strParam);
}
$FC->addGanttCategorySet("bgColor=99cc00;fontColor=333333;isBold=1;fontSize=10;bgAlpha=40;align=center");
for ($y = $startyear; $y <= $endyear; $y++) {
$lastmonth = ($y == $endyear) ? $maxdate->toFormat('%m')+1 : 13;
$firstmonth = ($y == $startyear) ? (int)$mindate->toFormat('%m') : 1;
for ($m = $firstmonth; $m < $lastmonth; $m++) {
$starttime = mktime(0, 0, 0, $m, 1, $y);
$start = date('Y/m/d', $starttime);
$end = date('Y/m/d', mktime(0, 0, 0, $m+1, 0, $y));//use day = 0 to load last day of next month
$m2 = $monthdisplay == 'str' ? JText::_(date('M', $starttime)) : $m;
$FC->addGanttCategory($m2, "start=".$start.";end=".$end.";");
}
}
# Render Chart
return $FC->renderChart(false, false);
}