本文整理汇总了PHP中GanttGraph::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP GanttGraph::Add方法的具体用法?PHP GanttGraph::Add怎么用?PHP GanttGraph::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GanttGraph
的用法示例。
在下文中一共展示了GanttGraph::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGanttGraph
/**
* @param int $teamid
* @param int $startTimestamp
* @param int $endTimestamp
* @param int[] $projectIds
* @return GanttGraph
*/
private function getGanttGraph($teamid, $startTimestamp, $endTimestamp, array $projectIds)
{
$graph = new GanttGraph();
// set graph title
$team = TeamCache::getInstance()->getTeam($teamid);
if (0 != count($projectIds)) {
$pnameList = "";
foreach ($projectIds as $pid) {
if ("" != $pnameList) {
$pnameList .= ",";
}
$project = ProjectCache::getInstance()->getProject($pid);
$pnameList .= $project->getName();
}
$graph->title->Set(T_('Team') . ' ' . $team->getName() . ' ' . T_('Project(s)') . ': ' . $pnameList);
} else {
$graph->title->Set(T_('Team') . ' ' . $team->getName() . ' (' . T_('All projects') . ')');
}
// Setup scale
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAYWNBR);
$gantManager = new GanttManager($teamid, $startTimestamp, $endTimestamp);
$teamActivities = $gantManager->getTeamActivities();
// mapping to ease constrains building
// Note: $issueActivityMapping must be completed before calling $a->getJPGraphBar()
$issueActivityMapping = array();
$activityIdx = 0;
foreach ($teamActivities as $a) {
$a->setActivityIdx($activityIdx);
$issueActivityMapping[$a->bugid] = $activityIdx;
++$activityIdx;
}
// Add the specified activities
foreach ($teamActivities as $a) {
// FILTER on projects
if (NULL != $projectIds && 0 != sizeof($projectIds)) {
$issue = IssueCache::getInstance()->getIssue($a->bugid);
if (!in_array($issue->getProjectId(), $projectIds)) {
// skip activity indexing
continue;
}
}
$filterTeamActivities[] = $a;
// Shorten bar depending on gantt startDate
if (NULL != $startTimestamp && $a->startTimestamp < $startTimestamp) {
// leave one day to insert prefixBar
$newStartTimestamp = $startTimestamp + 60 * 60 * 24;
if ($newStartTimestamp > $a->endTimestamp) {
// there is not enough space for a prefixBar
$newStartTimestamp = $startTimestamp;
self::$logger->debug("bugid=" . $a->bugid . ": Shorten bar to Gantt start date");
} else {
$formattedStartDate = date('Y-m-d', $startTimestamp);
$prefixBar = new GanttBar($a->activityIdx, "", $formattedStartDate, $formattedStartDate, "", 10);
$prefixBar->SetBreakStyle(true, 'dotted', 1);
$graph->Add($prefixBar);
self::$logger->debug("bugid=" . $a->bugid . ": Shorten bar & add prefixBar");
}
self::$logger->debug("bugid=" . $a->bugid . ": Shorten bar from " . date('Y-m-d', $a->startTimestamp) . " to " . date('Y-m-d', $newStartTimestamp));
$a->startTimestamp = $newStartTimestamp;
}
$bar = $a->getJPGraphBar($issueActivityMapping);
$graph->Add($bar);
}
return $graph;
}
示例2: graph_schedule
function graph_schedule($data, $title, $show_day)
{
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_gantt.php";
// Some sample Gantt data
/*
$data = array(
array(0, " Bryce", "2009-08-28 11:00","2009-08-28 15:30"),
array(1, " Kyla", "2009-08-28 08:00","2009-08-28 15:30"),
array(2, " Nathan", "2009-08-28 08:00","2009-08-28 17:00")
);
*/
// Basic graph parameters
$graph = new GanttGraph(700);
$graph->SetMarginColor('darkgreen@0.8');
$graph->SetColor('white');
$graph->title->Set("{$title}'s Schedule");
$graph->title->SetColor('darkgray');
// We want to display day, hour and minute scales
if ($show_day) {
$graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR);
} else {
$graph->ShowHeaders(GANTT_HHOUR);
}
#$graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR);
#$graph->ShowHeaders(GANTT_HHOUR);
// Setup day format
$graph->scale->day->SetBackgroundColor('lightyellow:1.5');
$graph->scale->day->SetStyle(DAYSTYLE_LONG);
$graph->scale->day->SetFont(FF_FONT1, FS_NORMAL, 16);
// Setup hour format
$graph->scale->hour->SetIntervall(1);
$graph->scale->hour->SetBackgroundColor('lightyellow:1.5');
$graph->scale->hour->SetStyle(HOURSTYLE_HAMPM);
$graph->scale->hour->grid->SetColor('gray:0.8');
$graph->scale->hour->SetFont(FF_FONT1, FS_NORMAL, 13);
for ($i = 0; $i < count($data); ++$i) {
$bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], $data[$i][4]);
$bar->SetPattern(BAND_RDIAG, "yellow");
$bar->SetFillColor("gray");
$graph->Add($bar);
}
// Draw graph
$graph->Stroke();
}
示例3: date
}
if ($g_index > 0) {
$data[$g_index][3] = date("Y-m-d", $group_begin);
$data[$g_index][4] = date("Y-m-d", $group_end - 86400);
}
}
//$data = array(
// array(0,ACTYPE_GROUP, "Phase 1", "2001-10-26","2001-11-23",''),
// array(1,ACTYPE_NORMAL, " Label 2", "2001-11-01","2001-11-20",''),
// array(2,ACTYPE_NORMAL, " Label 3", "2001-10-26","2001-11-03",''),
// array(3,ACTYPE_MILESTONE," Phase 1 Done", "2001-11-23",'M2') );
// The constrains between the activities
//$constrains = array(array(2,1,CONSTRAIN_ENDSTART),
// array(1,3,CONSTRAIN_STARTSTART));
// progress
//$progress = array(array(1,0.4));
// Create the basic graph
$graph = new GanttGraph();
//$graph->title->SetFont(FF_BIG5,FS_NORMAL,10);
$graph->title->Set('Projects for ' . $User->getRealName());
// Setup scale
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
// Add the specified activities
//$graph->SetSimpleFont(FF_BIG5,10);
$graph->CreateSimple($data, $constrains, $progress);
$todayline = new GanttVLine(date('Y-m-d', time()), "Today");
$todayline->SetDayOffset(0.5);
$graph->Add($todayline);
// .. and stroke the graph
$graph->Stroke();
示例4: MileStone
// Open
break;
case 4:
$pattern = 'yellow';
// Suspended
break;
default:
$pattern = 'yellow';
// default color
}
$activity->SetPattern(BAND_RDIAG, $pattern);
$activity->caption->Set($listTasks->tas_mem_login[$i] . ' (' . $printProgress . '%)');
$activity->caption->SetFont(FF_FONT0);
$activity->SetFillColor($pattern);
if ($listTasks->tas_priority[$i] == 4 || $listTasks->tas_priority[$i] == 5) {
$activity->progress->SetPattern(BAND_SOLID, 'red');
} else {
$activity->progress->SetPattern(BAND_SOLID, 'darkred');
}
$activity->progress->Set($progress);
$graph->Add($activity);
} else {
// build a milestone
$ms_cnt++;
$ms = new MileStone($i, $listTasks->tas_name[$i], $listTasks->tas_start_date[$i], 'M' . $ms_cnt);
$ms->title->SetFont(FF_FONT1, FS_BOLD);
$ms->title->SetColor('darkred');
$graph->Add($ms);
}
}
$graph->Stroke();
示例5: CDate
if ($day_diff > 240) {
//more than 240 days
$graph2->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH);
} else {
if ($day_diff > 90) {
//more than 90 days and less of 241
$graph2->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HWEEK);
$graph2->scale->week->SetStyle(WEEKSTYLE_WNBR);
}
}
$row = 0;
if (!is_array($tasks) || sizeof($tasks) == 0) {
$d = new CDate();
$bar = new GanttBar($row++, array(' ' . $AppUI->_('No tasks found'), ' ', ' ', ' '), $d->getDate(), $d->getDate(), ' ', 0.6);
$bar->title->SetCOlor('red');
$graph2->Add($bar);
}
if (is_array($tasks)) {
$nameUser = '';
foreach ($tasks as $t) {
if ($nameUser != $t['user_name']) {
$row++;
$barTmp = new GanttBar($row++, array($t['user_name'], '', '', ' '), '0', '0;', 0.6);
$barTmp->title->SetColor('#' . $t['project_color_identifier']);
$barTmp->SetFillColor('#' . $t['project_color_identifier']);
if (is_file(TTF_DIR . 'FreeSansBold.ttf')) {
$barTmp->title->SetFont(FF_CUSTOM, FF_BOLD);
}
$graph2->Add($barTmp);
}
if ($locale_char_set == 'utf-8' && function_exists('utf_decode')) {
示例6: CDate
//more than 240 days
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH);
} else {
if ($day_diff > 90) {
//more than 90 days and less of 241
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_WNBR);
}
}
$row = 0;
if (!is_array($projects) || sizeof($projects) == 0) {
$d = new CDate();
$bar = new GanttBar($row++, array(' ' . $AppUI->_('No projects found'), ' ', ' ', ' '), $d->getDate(), $d->getDate(), ' ', 0.6);
$bar->title->SetFont(FF_CUSTOM, FS_NORMAL, 8);
$bar->title->SetColor('red');
$graph->Add($bar);
}
if (is_array($projects)) {
foreach ($projects as $p) {
if ($locale_char_set == 'utf-8' && function_exists('utf8_decode')) {
$name = mb_strlen(utf8_decode($p['project_name'])) > 25 ? mb_substr(utf8_decode($p['project_name']), 0, 22) . '...' : utf8_decode($p['project_name']);
} else {
//while using charset different than UTF-8 we need not to use utf8_deocde
$name = mb_strlen($p['project_name']) > 25 ? mb_substr($p['project_name'], 0, 22) . '...' : $p['project_name'];
}
//using new jpGraph determines using Date object instead of string
$start = $p['project_start_date'] > '0000-00-00 00:00:00' ? $p['project_start_date'] : date('Y-m-d H:i:s');
$end_date = $p['project_end_date'] > '0000-00-00 00:00:00' ? $p['project_end_date'] : date('Y-m-d H:i:s', time());
$end_date = new CDate($end_date);
//$end->addDays(0);
$end = $end_date->getDate();
示例7: graficar
public function graficar($filename)
{
$graph = new GanttGraph();
$graph->SetShadow();
$graph->SetBox();
// Only show part of the Gantt
$graph = new GanttGraph(1000);
/*
$graph->title->Set('Proceso '.$this->dataSource->getParameter('desc_proceso_macro')."\n".
'Seguimiento de Solicitud '.$this->dataSource->getParameter('numero')."\n".
'Unidad '.$this->dataSource->getParameter('desc_uo'));
$graph->title->SetFont(FF_ARIAL,FS_BOLD,6);
*/
define('UTF-8', $locale_char_set);
// Setup some "very" nonstandard colors
$graph->SetMarginColor('lightgreen@0.8');
$graph->SetBox(true, 'yellow:0.6', 2);
$graph->SetFrame(true, 'darkgreen', 4);
$graph->scale->divider->SetColor('yellow:0.6');
$graph->scale->dividerh->SetColor('yellow:0.6');
// Explicitely set the date range
// (Autoscaling will of course also work)
// Display month and year scale with the gridlines
$graph->ShowHeaders(GANTT_HMONTH | GANTT_HYEAR | GANTT_HDAY);
$graph->scale->month->grid->SetColor('gray');
$graph->scale->month->grid->Show(true);
$graph->scale->year->grid->SetColor('gray');
$graph->scale->year->grid->Show(true);
// Setup a horizontal grid
$graph->hgrid->Show();
$graph->hgrid->SetRowFillColor('darkblue@0.9');
// Setup activity info
// For the titles we also add a minimum width of 100 pixels for the Task name column
$graph->scale->actinfo->SetColTitles(array('Tipo', 'Estado', 'Responsable', 'Duracion', 'Inicio', 'Fin'), array(40, 100));
$graph->scale->actinfo->SetBackgroundColor('green:0.5@0.5');
$graph->scale->actinfo->SetFont(FF_ARIAL, FS_NORMAL, 10);
$data = array();
$dataset = $this->dataSource->getDataset();
$tamanioDataset = count($dataset);
$fechaInicio = 0;
$fechaFin = 0;
for ($i = 0; $i < $tamanioDataset; $i++) {
if ($i == 0) {
$fechaInicio = $dataset[$i]['fecha_reg'];
}
/*
if($dataset[$i]['nombre_estado']=='En_Proceso'||$dataset[$i]['nombre_estado']=='Habilitado para pagar'||$dataset[$i]['nombre_estado']=='En Pago'){
$milestone = new MileStone($i,$dataset[$i]['nombre_estado'],$dataset[$i]['fecha_reg'],$dataset[$i]['fecha_reg']);
$milestone->title->SetColor("black");
$milestone->title->SetFont(FF_FONT1,FS_BOLD);
$graph->Add($milestone);
continue;
}
*/
$actividad = array();
array_push($actividad, $i);
if ($i == $tamanioDataset - 1) {
$fechaFin = $dataset[$i]['fecha_reg'];
} else {
$fechaFin = $dataset[$i + 1]['fecha_reg'];
}
$startLiteral = new DateTime($dataset[$i]['fecha_reg']);
$endLiteral = new DateTime($fechaFin);
$start = strtotime($dataset[$i]['fecha_reg']);
$end = strtotime($fechaFin);
$days_between = round(($end - $start) / 86400);
$cabecera = array($dataset[$i]['proceso'], $dataset[$i]['estado'], $dataset[$i]['funcionario'] != '-' ? $dataset[$i]['func'] : $dataset[$i]['depto'], "{$days_between}" . ' dias', $startLiteral->format('d M Y'), $endLiteral->format('d M Y'));
array_push($actividad, $cabecera);
array_push($actividad, $dataset[$i]['fecha_reg']);
array_push($actividad, $fechaFin);
array_push($actividad, FF_ARIAL);
array_push($actividad, FS_NORMAL);
array_push($actividad, 8);
array_push($data, $actividad);
}
// Create the bars and add them to the gantt chart
for ($i = 0; $i < count($data); $i++) {
$bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], "[100%]", 10);
if (count($data[$i]) > 4) {
$bar->title->SetFont($data[$i][4], $data[$i][5], $data[$i][6]);
}
$bar->SetPattern(BAND_RDIAG, "yellow");
$bar->SetFillColor("gray");
$bar->progress->Set(1);
$bar->progress->SetPattern(GANTT_SOLID, "darkgreen");
$graph->Add($bar);
}
//$graph->SetDateRange($fechaInicio,$fechaFin);
$archivo = dirname(__FILE__) . '/../../../reportes_generados/' . $filename;
//$graph->StrokeCSIM();
//exit;
$graph->Stroke($archivo);
}
示例8: MileStone
$bar->SetFillColor("red");
// To indicate progress each bar can have a smaller bar within
// For illustrative purpose just set the progress to 50% for each bar
$bar->progress->Set(0.5);
// Each bar may also have optional left and right plot marks
// As illustration lets put a filled circle with a number at the end
// of each bar
$bar->rightMark->SetType(MARK_FILLEDCIRCLE);
$bar->rightMark->SetFillColor("red");
$bar->rightMark->SetColor("red");
$bar->rightMark->SetWidth(10);
// Title for the mark
$bar->rightMark->title->Set("" . $i + 1);
$bar->rightMark->title->SetColor("white");
$bar->rightMark->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$bar->rightMark->Show();
// ... and add the bar to the gantt chart
$graph->Add($bar);
}
// Create a milestone mark
$ms = new MileStone(7, "M5", "2001-12-10", "10/12");
$ms->title->SetFont(FF_FONT1, FS_BOLD);
$graph->Add($ms);
// Create a vertical line to emphasize the milestone
$vl = new GanttVLine("2001-12-10 13:00", "Phase 1", "darkred");
$vl->SetDayOffset(0.5);
// Center the line in the day
$graph->Add($vl);
// Output the graph
$graph->Stroke();
// EOF
示例9: ganttPDF
function ganttPDF($reportName, $listTasks)
{
include "../includes/jpgraph/jpgraph.php";
include "../includes/jpgraph/jpgraph_gantt.php";
$graph = new GanttGraph();
$graph->SetBox();
$graph->SetMarginColor("white");
$graph->SetColor("white");
$graph->title->Set($strings["project"] . " " . $reportName);
// $graph->subtitle->Set("(".$strings["created"].": "..")");
$graph->title->SetFont(FF_FONT1);
$graph->SetColor("white");
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->week->SetFont(FF_FONT0);
$graph->scale->year->SetFont(FF_FONT1);
$comptListTasks = count($listTasks->tas_id);
$posGantt = 0;
for ($i = 0; $i < $comptListTasks; $i++) {
$listTasks->tas_name[$i] = str_replace('"', '"', $listTasks->tas_name[$i]);
$listTasks->tas_name[$i] = str_replace("'", "'", $listTasks->tas_name[$i]);
$progress = round($listTasks->tas_completion[$i] / 10, 2);
$printProgress = $listTasks->tas_completion[$i] * 10;
$activity = new GanttBar($posGantt, $listTasks->tas_pro_name[$i] . " / " . $listTasks->tas_name[$i], $listTasks->tas_start_date[$i], $listTasks->tas_due_date[$i]);
$activity->SetPattern(BAND_LDIAG, "yellow");
$activity->caption->Set($listTasks->tas_mem_login[$i] . " (" . $printProgress . "%)");
$activity->SetFillColor("gray");
if ($listTasks->tas_priority[$i] == "4" || $listTasks->tas_priority[$i] == "5") {
$activity->progress->SetPattern(BAND_SOLID, "#BB0000");
} else {
$activity->progress->SetPattern(BAND_SOLID, "#0000BB");
}
$activity->progress->Set($progress);
$graph->Add($activity);
// begin if subtask
$tmpquery = "WHERE task = " . $listTasks->tas_id[$i];
$listSubTasks = new request();
$listSubTasks->openSubtasks($tmpquery);
$comptListSubTasks = count($listSubTasks->subtas_id);
if ($comptListSubTasks >= 1) {
// list subtasks
for ($j = 0; $j < $comptListSubTasks; $j++) {
$listSubTasks->subtas_name[$j] = str_replace('"', '"', $listSubTasks->subtas_name[$j]);
$listSubTasks->subtas_name[$j] = str_replace("'", "'", $listSubTasks->subtas_name[$j]);
$progress = round($listSubTasks->subtas_completion[$j] / 10, 2);
$printProgress = $listSubTasks->subtas_completion[$j] * 10;
$posGantt += 1;
// $activity = new GanttBar($posGantt,$listTasks->tas_pro_name[$i]." / ".$listSubTasks->subtas_name[$j],$listSubTasks->subtas_start_date[$j],$listSubTasks->subtas_due_date[$j]);
// change name of project for name of parent task
$activity = new GanttBar($posGantt, $listSubTasks->subtas_tas_name[$j] . " / " . $listSubTasks->subtas_name[$j], $listSubTasks->subtas_start_date[$j], $listSubTasks->subtas_due_date[$j]);
//$activity = new GanttBar($j,$strings["project"].": ".$listSubTasks->subtas_pro_name[$j]." / ".$strings["task"].": ".$listSubTasks->subtas_name[$j],$listSubTasks->subtas_start_date[$j],$listSubTasks->subtas_due_date[$j]);
$activity->SetPattern(BAND_LDIAG, "yellow");
$activity->caption->Set($listSubTasks->subtas_mem_login[$j] . " (" . $printProgress . "%)");
$activity->SetFillColor("gray");
if ($listSubTasks->subtas_priority[$j] == "4" || $listSubTasks->subtas_priority[$j] == "5") {
$activity->progress->SetPattern(BAND_SOLID, "#BB0000");
} else {
$activity->progress->SetPattern(BAND_SOLID, "#0000BB");
}
$activity->progress->Set($progress);
$graph->Add($activity);
}
// end for comptListSubTasks
}
// end if subtask
$posGantt += 1;
}
// end for complisttask
$tmpGantt = "../files/" . md5(uniqid(rand()));
$graph->Stroke($tmpGantt);
return $tmpGantt;
}
示例10: GanttBar
// Specify progress to 60%
$activity->progress->Set(0.6);
$activity->progress->SetPattern(BAND_HVCROSS, "blue");
// Format the bar for the second activity
// ($row,$title,$startdate,$enddate)
$activity2 = new GanttBar(1, "Project", "2001-12-21", "2001-12-27", "[30%]");
// Yellow diagonal line pattern on a red background
$activity2->SetPattern(BAND_RDIAG, "yellow");
$activity2->SetFillColor("red");
// Set absolute height
$activity2->SetHeight(10);
// Specify progress to 30%
$activity2->progress->Set(0.3);
$activity2->progress->SetPattern(BAND_HVCROSS, "blue");
// Finally add the bar to the graph
$graph->Add($activity);
$graph->Add($activity2);
// Add text to top left corner of graph
$txt1 = new Text();
$txt1->SetPos(5, 2);
$txt1->Set("Note:\nEstimate done w148");
$txt1->SetFont(FF_ARIAL, FS_BOLD, 12);
$txt1->SetColor('darkred');
$graph->Add($txt1);
// Add text to the top bar
$txt2 = new Text();
$txt2->SetScalePos("2002-01-01", 1);
$txt2->SetFont(FF_ARIAL, FS_BOLD, 12);
$txt2->SetAlign('left', 'center');
$txt2->Set("Remember this!");
$txt2->SetBox('yellow');
示例11: GanttBar
$graph->scale->month->SetFontColor("white");
$graph->scale->month->SetBackgroundColor("blue");
// 0 % vertical label margin
$graph->SetLabelVMarginFactor(1);
// 1=default value
// Format the bar for the first activity
// ($row,$title,$startdate,$enddate)
$activity1 = new GanttBar(0, "Activity 1", "2001-12-21", "2001-12-26", "");
// Yellow diagonal line pattern on a red background
$activity1->SetPattern(BAND_RDIAG, "yellow");
$activity1->SetFillColor("red");
// Format the bar for the first activity
// ($row,$title,$startdate,$enddate)
$break1 = new GanttBar(0, '', "2001-12-27", "2001-12-30", "");
$break1->SetBreakStyle(true, 'dotted', 2);
$break1->SetColor('red');
$graph->Add($break1);
// Format the bar for the second activity
// ($row,$title,$startdate,$enddate)
$activity2 = new GanttBar(0, "", "2001-12-31", "2002-01-2", "[BO]");
// ADjust font for caption
$activity2->caption->SetFont(FF_ARIAL, FS_BOLD);
$activity2->caption->SetColor("darkred");
// Yellow diagonal line pattern on a red background
$activity2->SetPattern(BAND_RDIAG, "yellow");
$activity2->SetFillColor("red");
// Finally add the bar to the graph
$graph->Add($activity1);
$graph->Add($activity2);
// ... and display it
$graph->Stroke();
示例12: createGanttGraph
private function createGanttGraph($dataorder, $datalabel, $datastart, $dataende, $datamilestone, $dataprogress, $scale, $title, $constraitkey, $constraitvalue, $constrait, $startdate, $enddate)
{
// Create the graph.
$graph = new GanttGraph($this->width, $this->height, "auto");
$graph->scale->actinfo->SetColTitles(array('Paket'), array(30));
// $icon = new IconPlot( dirname(__FILE__).'/../../themes/basic/gfx/logorisklogiq.png', 0.65,0.90,1 ,40);
// $icon->SetAnchor( 'left', 'bottom');
// $graph->Add( $icon);
$todaydate = new DateTime();
$vline = new GanttVLine($todaydate->format("Y-m-d"), "Today");
$graph->Add($vline);
if ($startdate == NULL) {
$myDate = new DateTime();
$startdate = $myDate->format("Y-m-d");
}
if ($enddate == NULL) {
$my2Date = new DateTime($startdate);
$my2Date->modify("30days");
$enddate = $my2Date->format("Y-m-d");
}
$graph->SetDateRange($startdate, $enddate);
$graph->title->Set($title);
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
$graph->scale->week->setStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->month->setStyle(MONTHSTYLE_SHORTNAMEYEAR2);
// Setup a horizontal grid
$graph->hgrid->Show();
$graph->hgrid->SetRowFillColor('darkblue@0.93');
if ($this->shadow) {
$graph->SetShadow();
}
$mapper = array();
$mydata = array();
$progress = array();
$color = array();
$ii = 0;
foreach ($this->dataorder as $dorder) {
if ($datamilestone[$ii] == 0) {
$mapper[$dataorder[$ii]] = $ii;
array_push($mydata, array($ii, ACTYPE_NORMAL, $datalabel[$ii], $datastart[$ii], $dataende[$ii], ' '));
array_push($progress, array($ii, $dataprogress[$ii] / 100));
array_push($color, array($ii, 'gray'));
} else {
$mapper[$dataorder[$ii]] = $ii;
array_push($mydata, array($ii, ACTYPE_MILESTONE, $datalabel[$ii], $datastart[$ii], $datalabel[$ii]));
}
$ii++;
}
$myconstrait = array();
$ii = 0;
foreach ($constraitkey as $dorder) {
array_push($myconstrait, array($mapper[$constraitvalue[$ii]], $mapper[$constraitkey[$ii]], $constrait[$ii]));
$ii++;
}
//print_r($myconstrait);
//print_r($mydata);
$graph->CreateSimple($mydata, $myconstrait, $progress, $color);
return $graph;
}
示例13: count
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
// Make the week scale font smaller than the default
if (isset($gantt_title_font_family)) {
$graph->scale->week->SetFont(constant($gantt_title_font_family), FS_NORMAL, 9);
$graph->scale->month->SetFont(constant($gantt_title_font_family), FS_NORMAL, 9);
}
// Use the short name of the month together with a 2 digit year
// on the month scale
$graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR2);
$rows = count($pt_arr);
for ($i = 0; $i < $rows; $i++) {
// Format the bar for the first activity
// ($row,$title,$startdate,$enddate)
$activity[$i] = new GanttBar($i, convert_unicode($pt_arr[$i]->getSummary()), date('Y-m-d', $pt_arr[$i]->getStartDate()), date('Y-m-d', $pt_arr[$i]->getEndDate() - 86400));
// Yellow diagonal line pattern on a red background
$activity[$i]->SetPattern(BAND_RDIAG, "yellow");
$activity[$i]->SetFillColor("red");
$activity[$i]->progress->Set($pt_arr[$i]->getPercentComplete() ? $pt_arr[$i]->getPercentComplete() / 100 : 0);
$activity[$i]->progress->SetPattern(BAND_RDIAG, "blue");
if (isset($gantt_task_font_family)) {
$activity[$i]->title->SetFont(constant($gantt_task_font_family), constant($gantt_task_font_style), $gantt_task_font_size);
}
// Finally add the bar to the graph
$graph->Add($activity[$i]);
}
//echo $rows;
$todayline = new GanttVLine(date('Y-m-d', time()), "Today");
$todayline->SetDayOffset(0.5);
$graph->Add($todayline);
// Display the Gantt chart
$graph->Stroke();
示例14: GanttVLine
if (count($data[$i]) > 4) {
$bar->title->SetFont($data[$i][4], $data[$i][5], $data[$i][6]);
}
$bar->rightMark->Show();
$bar->rightMark->SetType(MARK_FILLEDCIRCLE);
$bar->rightMark->SetWidth(8);
$bar->rightMark->SetColor("red");
$bar->rightMark->SetFillColor("red");
$bar->rightMark->title->Set($i + 1);
$bar->rightMark->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$bar->rightMark->title->SetColor("white");
$bar->SetPattern(BAND_RDIAG, "yellow");
$bar->SetFillColor("red");
$bar->progress->Set($i / 10);
$bar->progress->SetPattern(GANTT_SOLID, "darkgreen");
$graph->Add($bar);
}
// The line will NOT be shown since it is outside the specified slice
$vline = new GanttVLine("2002-02-28");
$vline->title->Set("2002-02-28");
$vline->title->SetFont(FF_FONT1, FS_BOLD, 10);
$graph->Add($vline);
// The milestone will NOT be shown since it is outside the specified slice
$ms = new MileStone(7, "M5", "2002-01-28", "28/1");
$ms->title->SetFont(FF_FONT1, FS_BOLD);
$graph->Add($ms);
$graph->Stroke();
?>
示例15: array
// on the month scale
$graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR2);
$graph->scale->month->SetFontColor("white");
$graph->scale->month->SetBackgroundColor("blue");
// 0 % vertical label margin
$graph->SetLabelVMarginFactor(1);
$i = 0;
$activity = array();
$colornode =& atkGetNode("project.mastergantt_colorconfig");
foreach ($gant as $id => $gantphase) {
// Projects that extent the selected period should be cut off.
if ($gantphase['startdate'] < $from) {
$gantphase['startdate'] = $from;
}
if ($gantphase['enddate'] > $to || $gantphase['enddate'] == '') {
$gantphase['enddate'] = $to;
}
$caption = "[" . time_format($gantphase[$plannedbooked], true) . "]";
$activity[$i] = new GanttBar($i, $gantphase['name'], $gantphase['startdate'], $gantphase['enddate'], $caption);
$colorbase = $gantphase[$plannedbooked];
$color = $colornode->getColor($colorbase / 60);
$activity[$i]->SetPattern(BAND_SOLID, $color);
$activity[$i]->SetHeight(10);
$activity[$i]->SetFillColor($color);
$i++;
}
atkimport("module.utils.dateutil");
for ($i = 0, $_i = count($activity); $i < $_i; $i++) {
$graph->Add($activity[$i]);
}
$graph->Stroke();