本文整理汇总了PHP中FusionCharts::addTrendLine方法的典型用法代码示例。如果您正苦于以下问题:PHP FusionCharts::addTrendLine方法的具体用法?PHP FusionCharts::addTrendLine怎么用?PHP FusionCharts::addTrendLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FusionCharts
的用法示例。
在下文中一共展示了FusionCharts::addTrendLine方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FusionCharts
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>
<?php
# Render Chart
$FC->renderChart();
示例2: fs_gantt_chart
//.........这里部分代码省略.........
}
$chart->addGanttCategory(date('F', mktime(0, 0, 0, $j, 1)), ';start=' . $start . ';end=' . $end . ';align=center;isBold=1');
}
}
// Days
if ($time_span < 2592000) {
$chart->addGanttCategorySet();
for ($i = $start_year; $i <= $end_year; $i++) {
for ($j = 1; $j <= 12; $j++) {
if ($i == $start_year && $j < $start_month) {
continue;
} else {
if ($i == $end_year && $j > $end_month) {
break;
}
}
$num_days = cal_days_in_month(CAL_GREGORIAN, $j, $i);
for ($k = 1; $k <= $num_days; $k++) {
if ($i == $start_year && $j == $start_month && $k < $start_day) {
continue;
} else {
if ($i == $end_year && $j == $end_month && $k > $end_day) {
break;
}
}
$start = sprintf('%02d/%02d/%04d', $k, $j, $i);
$end = sprintf('%02d/%02d/%04d', $k, $j, $i);
$chart->addGanttCategory($k, ';start=' . $start . ';end=' . $end . ';fontSize=8;isBold=0');
}
}
}
} else {
if ($time_span < 10368000) {
$chart->addGanttCategorySet();
for ($i = $start_year; $i <= $end_year; $i++) {
for ($j = 1; $j <= 12; $j++) {
if ($i == $start_year && $j < $start_month) {
continue;
} else {
if ($i == $end_year && $j > $end_month) {
break;
}
}
$num_days = cal_days_in_month(CAL_GREGORIAN, $j, $i);
for ($k = 1, $l = 1; $k <= $num_days; $k += 8, $l++) {
if ($i == $start_year && $j == $start_month && $k + 7 < $start_day) {
continue;
}
if ($i == $end_year && $j == $end_month && $k > $end_day) {
break;
}
if ($i == $start_year && $j == $start_month && $k < $start_day) {
$start = sprintf('%02d/%02d/%04d', $start_day, $j, $i);
} else {
$start = sprintf('%02d/%02d/%04d', $k, $j, $i);
}
if ($i == $end_year && $j == $end_month && $k + 7 > $end_day) {
$end = sprintf('%02d/%02d/%04d', $end_day, $j, $i);
} else {
if ($k + 7 > $num_days) {
$end = sprintf('%02d/%02d/%04d', $num_days, $j, $i);
} else {
$end = sprintf('%02d/%02d/%04d', $k + 7, $j, $i);
}
}
$chart->addGanttCategory(__('Week') . " {$l}", ';start=' . $start . ';end=' . $end . ';fontSize=8;isBold=0');
}
}
}
}
}
// Tasks
foreach ($tasks as $task) {
$chart->addGanttProcess(clean_flash_string($task['name']), 'id=' . $task['id'] . ';link=' . urlencode($task['link']));
$chart->addGanttTask(__('Planned'), 'start=' . $task['start'] . ';end=' . $task['end'] . ';id=' . $task['id'] . ';processId=' . $task['id'] . ';color=4b3cff;height=5;topPadding=10;animation=0');
if ($task['real_start'] !== false && $task['real_end']) {
$chart->addGanttTask(__('Actual'), 'start=' . $task['real_start'] . ';end=' . $task['real_end'] . ';processId=' . $task['id'] . ';color=ff3c4b;alpha=100;topPadding=15;height=5');
}
if ($task['completion'] != 0) {
$task_span = date_to_epoch($task['end']) - date_to_epoch($task['start']);
$end = date('d/m/Y', date_to_epoch($task['start']) + $task_span * $task['completion'] / 100.0);
$chart->addGanttTask(__('Completion') . " (" . $task['completion'] . ")", 'start=' . $task['start'] . ';end=' . $end . ';processId=' . $task['id'] . ';color=32cd32;alpha=100;topPadding=20;height=5');
}
if ($task['parent'] != 0) {
$chart->addGanttConnector($task['parent'], $task['id'], 'color=2179b1;thickness=2;fromTaskConnectStart=1');
}
}
// Milestones
if ($milestones !== '') {
$chart->addGanttProcess(__('Milestones'), 'id=0');
foreach ($milestones as $milestone) {
$chart->addGanttTask(clean_flash_string($milestone['name']), 'start=' . $milestone['date'] . ';end=' . $milestone['date'] . ';id=ms-' . $milestone['id'] . ';processId=0;color=ffffff;alpha=0;height=60;topPadding=0;animation=0');
$chart->addGanttMilestone('ms-' . $milestone['id'], 'date=' . $milestone['date'] . ';radius=8;color=efbb07;shape=star;numSides=3;borderThickness=1');
}
}
// Today
$chart->addTrendLine('start=' . date('d/m/Y') . ';displayValue=' . __('Today') . ';color=666666;isTrendZone=1;alpha=20');
// Return the code
return get_chart_code($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Gantt.swf');
}
示例3: colon
$FC->setSWFPath("../FusionCharts/");
# Set colon (:) as delimiter
$FC->setParamDelimiter(":");
# 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:alpha=80");
$FC->addChartData("31400", "label=Week 2:alpha=60");
$FC->addChartData("26700", "label=Week 3");
$FC->addChartData("54400", "label=Week 4");
# Set hash (#) as delimiter
$FC->setParamDelimiter("#");
# Add TrendLine
$FC->addTrendLine("startValue=42000#color=ff0000#displayvalue=Target#showOnTop=1");
# Set semicolon (;) as delimiter
$FC->setParamDelimiter(";");
# Add TrendLine
$FC->addTrendLine("startValue=30000;color=008800;displayvalue=Average;showOnTop=1");
?>
<html>
<head>
<title>First Chart - Set Delimiter : Using FusionCharts PHP Class</title>
<script language='javascript' src='../FusionCharts/FusionCharts.js'></script>
</head>
<body>
<?php
# Render Chart
$FC->renderChart();
示例4:
$FC->addChartData("20", "y=72000;z=8");
$FC->addChartData("43", "y=42000;z=5");
$FC->addChartData("70", "y=90000;z=2");
$FC->addChartData("90", "y=75000;z=4");
# Add another dataset
$FC->addDataSet("Current Month");
# Add chart data for the above dataset
# where 1st parameter for X axis value
# 2nd parameter take Y and Z axis as parameter list
# e.g y=12200;z=10
$FC->addChartData("18", "y=22000;z=3");
$FC->addChartData("35", "y=62000;z=5");
$FC->addChartData("50", "y=55000;z=10");
$FC->addChartData("70", "y=25000;z=3");
# Add TrendLine
$FC->addTrendLine("startValue=50000;endValue=50000;color=00FF00;displayvalue=First Target;dashed=1");
# Add vTrendLine
$FC->addvTrendLine("startValue=0;endValue=39.99;color=888800;displayvalue=Low Sales;alpha=20");
?>
<html>
<head>
<title>Bubble Chart : Using FusionCharts PHP Class</title>
<script language='javascript' src='../FusionCharts/FusionCharts.js'></script>
</head>
<body>
<?php
# Render Chart
$FC->renderChart();
?>