本文整理汇总了PHP中GanttBar::SetColor方法的典型用法代码示例。如果您正苦于以下问题:PHP GanttBar::SetColor方法的具体用法?PHP GanttBar::SetColor怎么用?PHP GanttBar::SetColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GanttBar
的用法示例。
在下文中一共展示了GanttBar::SetColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GanttBar
$bar = new GanttBar($row++, array($name, $startdate->format($df), $enddate->format($df), $actual_enddate->format($df)), $start, $actual_end, $cap, 0.6);
$bar->progress->Set(min($progress / 100, 1));
if (is_file(TTF_DIR . "FreeSans.ttf")) {
$bar->title->SetFont(FF_CUSTOM, FS_NORMAL, 9);
}
$bar->SetFillColor('#' . $p['project_color_identifier']);
$bar->SetPattern(BAND_SOLID, '#' . $p['project_color_identifier']);
//adding captions
$bar->caption = new TextProperty($caption);
$bar->caption->Align('left', 'center');
$bar->caption->SetFont(FF_CUSTOM, FS_NORMAL, 8);
// gray out templates, completes, on ice, on hold
if ($p['project_status'] != '3' || $p['project_status'] == '7') {
$bar->caption->SetColor('darkgray');
$bar->title->SetColor('darkgray');
$bar->SetColor('darkgray');
$bar->SetFillColor('gray');
//$bar->SetPattern(BAND_SOLID,'gray');
$bar->progress->SetFillColor('darkgray');
$bar->progress->SetPattern(BAND_SOLID, 'darkgray', 98);
}
$graph->Add($bar);
// If showAllGant checkbox is checked
if ($showAllGantt) {
// insert tasks into Gantt Chart
// select for tasks for each project
$q->addTable('tasks', 't');
$q->addQuery('DISTINCT t.task_id, t.task_name, t.task_start_date, t.task_end_date' . ', t.task_milestone, t.task_dynamic');
$q->addJoin('projects', 'p', 'p.project_id = t.task_project');
$q->addWhere('p.project_id = ' . $p['project_id']);
$q->addOrder($sortTasksByName ? 't.task_name' : 't.task_end_date ASC');
示例2: DEFINE
//.........这里部分代码省略.........
$spro[] = array('title' => str_repeat(' ', $spro['level']) . '[!]' . $previous['title'], 'extracolor' => 'darkorange', 'sdate' => $previous['sdate'], 'edate' => $previous['edate'], 'pro_id' => $previous['project_id'], 'f_sdate' => $pro['sdate']);
$color_legend['previous'] = array('title' => '[!]' . lang('previous project'), 'extracolor' => 'darkorange');
}
// add a empty row before new project
if ($pro['level'] == 0 && $counter > 0) {
$counter++;
}
$spro = array('title' => $pro['title'], 'sdate' => $pro['sdate'], 'edate' => $pro['edate'] ? $pro['edate'] : mktime(0, 0, 0, date('m'), date('d'), date('Y')), 'color' => $pro['level'], 'pro_id' => $pro['project_id'], 'previous' => $pro['previous']);
// convert title to iso-8859-1
$spro[title] = $this->botranslation->convert($spro[title], $this->displayCharset, 'iso-8859-1');
if ($spro[edate] < $sdate) {
continue;
}
if ($spro[edate] > $edate) {
$spro[edate] = $edate;
}
if ($spro[sdate] < $sdate) {
$spro[sdate] = $sdate;
}
$bar = new GanttBar($counter, $spro[title], date('Y-m-d', $spro[sdate]), date('Y-m-d', $spro[edate]), round($finnishedPercent) . '%', 0.5);
// mark beginn of new project bold
if ($pro['level'] == 0) {
$bar->title->SetFont(FF_VERA, FS_BOLD, 9);
#$bar->title->SetColor("#9999FF");
$bar->SetPattern(BAND_SOLID, "#9999FF");
} else {
// For illustration lets make each bar be red with yellow diagonal stripes
$bar->SetPattern(BAND_SOLID, "#ccccFF");
#$bar->title->SetColor("#ccccFF");
}
// 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->SetHeight(0.2);
$bar->SetColor('#777777');
if ($finnishedPercent > 100) {
$bar->progress->Set(1);
#$bar->progress->SetPattern(GANTT_SOLID,"darkred",98);
$bar->caption->SetColor("red");
} else {
$bar->progress->Set($finnishedPercent / 100);
#$bar->progress->SetPattern(GANTT_SOLID,"darkgreen",98);
}
$bar->caption->SetFont(FF_VERA, FS_NORMAL, 8);
// ... and add the bar to the gantt chart
$graphs['bars'][] = $bar;
#$graph->Add($bar);
$counter++;
// check for Resources
if ($showResources == 'true') {
$linkedObjects = $bolink->get_links('projects', $pro[project_id]);
$projectACL = $this->boprojects->get_acl_for_project($pro[project_id]);
if (is_array($projectACL)) {
// if beginn
foreach ($projectACL as $accountID) {
#_debug_array($projectData);
$accountData = CreateObject('phpgwapi.accounts', $accountID);
$accountData->read_repository();
$accountName = $GLOBALS['phpgw']->common->display_fullname($accountData->data['account_lid'], $accountData->data['firstname'], $accountData->data['lastname']);
$calData = array('syear' => date('Y', $sdate), 'smonth' => date('m', $sdate), 'sday' => date('d', $sdate), 'eyear' => date('Y', $edate), 'emonth' => date('m', $edate), 'eday' => date('d', $edate), 'owner' => array($accountID));
$calEntries = $bocalendar->store_to_cache($calData);
$bocalendar->remove_doubles_in_cache(date('Y', $sdate) . date('m', $sdate) . date('d', $sdate), date('Y', $edate) . date('m', $edate) . date('d', $edate));
$calEntries = $bocalendar->cached_events;
#_debug_array($calEntries);
if (is_array($calEntries) && count($calEntries)) {
#_debug_array($calEntries);
foreach ($calEntries as $calDayDate => $calDayEntries) {
示例3: addBar
public function addBar(array $columnValues, $caption = '', $height = '0.6', $barcolor = 'FFFFFF', $active = true, $progress = 0)
{
foreach ($columnValues as $name => $value) {
switch ($name) {
case 'start_date':
$start = $value;
$startDate = new CDate($value);
$rowValues[] = $startDate->format($this->df);
break;
case 'end_date':
$endDate = new CDate($value);
$rowValues[] = $endDate->format($this->df);
break;
case 'actual_end':
$actual_end = $value;
$actual_endDate = new CDate($value);
$rowValues[] = $actual_endDate->format($this->df);
break;
case 'project_name':
case 'task_name':
default:
$rowValues[] = $value;
}
}
$bar = new GanttBar($this->rowCount++, $rowValues, $start, $actual_end, $caption, $height);
$bar->progress->Set(min($progress / 100, 1));
$bar->title->SetFont(FF_CUSTOM, FS_NORMAL, 9);
$bar->title->SetColor(bestColor('#ffffff', '#' . $barcolor, '#000000'));
$bar->SetFillColor('#' . $barcolor);
$bar->SetPattern(BAND_SOLID, '#' . $barcolor);
if (0.1 == $height) {
$bar->rightMark->Show();
$bar->rightMark->SetType(MARK_RIGHTTRIANGLE);
$bar->rightMark->SetWidth(3);
$bar->rightMark->SetColor('black');
$bar->rightMark->SetFillColor('black');
$bar->leftMark->Show();
$bar->leftMark->SetType(MARK_LEFTTRIANGLE);
$bar->leftMark->SetWidth(3);
$bar->leftMark->SetColor('black');
$bar->leftMark->SetFillColor('black');
$bar->SetPattern(BAND_SOLID, 'black');
}
//adding captions
$bar->caption = new TextProperty($caption);
$bar->caption->Align('left', 'center');
if (is_file(TTF_DIR . 'FreeSans.ttf')) {
$bar->caption->SetFont(FF_CUSTOM, FS_NORMAL, 8);
}
// gray out templates, completes, on ice, on hold
if (!$active) {
$bar->caption->SetColor('darkgray');
$bar->title->SetColor('darkgray');
$bar->SetColor('darkgray');
$bar->SetFillColor('gray');
$bar->progress->SetFillColor('darkgray');
$bar->progress->SetPattern(BAND_SOLID, 'darkgray', 98);
}
$this->graph->Add($bar);
}
示例4: 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();