本文整理汇总了PHP中GanttBar::SetFillColor方法的典型用法代码示例。如果您正苦于以下问题:PHP GanttBar::SetFillColor方法的具体用法?PHP GanttBar::SetFillColor怎么用?PHP GanttBar::SetFillColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GanttBar
的用法示例。
在下文中一共展示了GanttBar::SetFillColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: GanttBar
$graph->scale->day->SetSundayFontColor('black');
$graph->scale->hour->SetFont(FF_FONT1);
$graph->scale->hour->SetIntervall(1);
$graph->scale->hour->SetStyle(HOURSTYLE_H24);
$graph->hgrid->SetRowFillColor('whitesmoke@0.9', 'darkblue@0.9');
$graph->setMargin(0, 0, 0, 20);
$graph->scale->hour->SetFont(FF_FONT1);
$graph->scale->day->SetFont(FF_FONT1, FS_BOLD);
$graph->title->SetColor('white');
$graph->scale->UseWeekendBackground(false);
$graph->scale->day->SetWeekendColor('lightyellow:1.5');
$graph->scale->week->SetFont(FF_FONT1);
$graph->hgrid->Show(true);
$graph->hgrid->SetRowFillColor('whitesmoke@0.9', 'darkblue@0.9');
if ($suma > 0) {
for ($i = 0; $i < count($data); ++$i) {
$bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3]);
$bar->SetPattern(BAND_RDIAG, 'lightgray');
$bar->SetFillColor('brown');
$bar->SetShadow(true, 'black@0.5');
$graph->Add($bar);
}
} else {
$bar = new GanttBar(0, $text["noactivity"], "23:59", "00:00");
$bar->SetPattern(BAND_RDIAG, 'white@1');
$graph->Add($bar);
}
$graph->footer->left->Set($text["totalingame"] . " " . formatTD($suma));
$graph->footer->left->SetColor('black@0.5');
$graph->footer->left->SetFont(FF_FONT2, FS_BOLD);
$graph->Stroke();
示例3: count
// Format and add the Gantt bars to the chart
$n = count($data);
for ($i = 0; $i < $n; ++$i) {
if ($i === 0 || $i === 3) {
// Format the group bars
$bar = new GanttBar($data[$i][0], array($data[$i][1], $data[$i][2], $data[$i][3]), $data[$i][2], $data[$i][3], '', 0.35);
// For each group make the name bold but keep the dates as the default font
$bar->title->SetColumnFonts(array(array(FF_ARIAL, FS_BOLD, 11)));
// Add group markers
$bar->leftMark->SetType(MARK_LEFTTRIANGLE);
$bar->leftMark->Show();
$bar->rightMark->SetType(MARK_RIGHTTRIANGLE);
$bar->rightMark->Show();
$bar->SetFillColor('black');
$bar->SetPattern(BAND_SOLID, 'black');
} else {
// Format the activity bars
$bar = new GanttBar($data[$i][0], array($data[$i][1], $data[$i][2], $data[$i][3]), $data[$i][2], $data[$i][3], '', 0.45);
$bar->SetPattern(BAND_RDIAG, 'black');
$bar->SetFillColor('orange');
}
// Default font
$bar->title->SetFont(FF_ARIAL, FS_NORMAL, 10);
$graph->Add($bar);
}
// Send back the graph to the client
$graph->Stroke();
?>
示例4: 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;
}
示例5: addSubSubBar
public function addSubSubBar($label, $start, $end, $caption = '', $height = '0.6', $barcolor = 'FFFFFF', $progress = 0)
{
$startDate = new CDate($start);
$endDate = new CDate($end);
$bar = new GanttBar($this->rowCount++, array($label, ' ', ' ', ' '), $startDate->format(FMT_DATETIME_MYSQL), $endDate->format(FMT_DATETIME_MYSQL), 0.6);
$bar->title->SetFont(FF_CUSTOM, FS_NORMAL, 9);
$bar->SetFillColor('#' . $barcolor);
$this->graph->Add($bar);
}
示例6: CreateSimple
function CreateSimple($data, $constrains = array(), $progress = array())
{
$num = count($data);
for ($i = 0; $i < $num; ++$i) {
switch ($data[$i][1]) {
case ACTYPE_GROUP:
// Create a slightly smaller height bar since the
// "wings" at the end will make it look taller
$a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 8);
$a->title->SetFont($this->iSimpleFont, FS_BOLD, $this->iSimpleFontSize);
$a->rightMark->Show();
$a->rightMark->SetType(MARK_RIGHTTRIANGLE);
$a->rightMark->SetWidth(8);
$a->rightMark->SetColor('black');
$a->rightMark->SetFillColor('black');
$a->leftMark->Show();
$a->leftMark->SetType(MARK_LEFTTRIANGLE);
$a->leftMark->SetWidth(8);
$a->leftMark->SetColor('black');
$a->leftMark->SetFillColor('black');
$a->SetPattern(BAND_SOLID, 'black');
$csimpos = 6;
break;
case ACTYPE_NORMAL:
$a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 10);
$a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
$a->SetPattern($this->iSimpleStyle, $this->iSimpleColor);
$a->SetFillColor($this->iSimpleBkgColor);
// Check if this activity should have a constrain line
$n = count($constrains);
for ($j = 0; $j < $n; ++$j) {
if (empty($constrains[$j]) || count($constrains[$j]) != 3) {
JpGraphError::RaiseL(6003, $j);
//("Invalid format for Constrain parameter at index=$j in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Constrain-To,Constrain-Type)");
}
if ($constrains[$j][0] == $data[$i][0]) {
$a->SetConstrain($constrains[$j][1], $constrains[$j][2], 'black', ARROW_S2, ARROWT_SOLID);
}
}
// Check if this activity have a progress bar
$n = count($progress);
for ($j = 0; $j < $n; ++$j) {
if (empty($progress[$j]) || count($progress[$j]) != 2) {
JpGraphError::RaiseL(6004, $j);
//("Invalid format for Progress parameter at index=$j in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Progress)");
}
if ($progress[$j][0] == $data[$i][0]) {
$a->progress->Set($progress[$j][1]);
$a->progress->SetPattern($this->iSimpleProgressStyle, $this->iSimpleProgressColor);
$a->progress->SetFillColor($this->iSimpleProgressBkgColor);
//$a->progress->SetPattern($progress[$j][2],$progress[$j][3]);
break;
}
}
$csimpos = 6;
break;
case ACTYPE_MILESTONE:
$a = new MileStone($data[$i][0], $data[$i][2], $data[$i][3]);
$a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
$a->caption->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
$csimpos = 5;
break;
default:
die('Unknown activity type');
break;
}
// Setup caption
$a->caption->Set($data[$i][$csimpos - 1]);
// Check if this activity should have a CSIM target�?
if (!empty($data[$i][$csimpos])) {
$a->SetCSIMTarget($data[$i][$csimpos]);
$a->SetCSIMAlt($data[$i][$csimpos + 1]);
}
if (!empty($data[$i][$csimpos + 2])) {
$a->title->SetCSIMTarget($data[$i][$csimpos + 2]);
$a->title->SetCSIMAlt($data[$i][$csimpos + 3]);
}
$this->Add($a);
}
}
示例7: foreach
}
//Insert workers for each task into Gantt Chart
$q->addTable('user_tasks', 't');
$q->addQuery('DISTINCT user_username, t.task_id');
$q->addJoin('users', 'u', 'u.user_id = t.user_id');
$q->addWhere('t.task_id = ' . $t['task_id']);
$q->addOrder('user_username ASC');
$workers = $q->loadList();
$q->clear();
$workersName = '';
foreach ($workers as $w) {
$workersName .= ' ' . $w['user_username'];
$bar3 = new GanttBar($row++, array(' * ' . $w['user_username'], ' ', ' ', ' '), $tStartObj->format(FMT_DATETIME_MYSQL), $tEndObj->format(FMT_DATETIME_MYSQL), 0.6);
$bar3->title->SetFont(FF_CUSTOM, FS_NORMAL, 9);
$bar3->title->SetColor(bestColor('#ffffff', '#' . $p['project_color_identifier'], '#000000'));
$bar3->SetFillColor('#' . $p['project_color_identifier']);
$graph->Add($bar3);
}
//End of insert workers for each task into Gantt Chart
}
unset($tasks);
//End of insert tasks into Gantt Chart
}
//End of if showAllGant checkbox is checked
}
}
// End of check for valid projects array.
unset($projects);
$today = date('y-m-d');
$vline = new GanttVLine($today, $AppUI->_('Today', UI_OUTPUT_RAW));
$vline->title->SetFont(FF_CUSTOM, FS_BOLD, 10);
示例8: addBar
public function addBar(array $columnValues, $caption = '', $height = '0.6', $barcolor = 'FFFFFF', $active = true, $progress = 0, $identifier = 0)
{
foreach ($columnValues as $name => $value) {
switch ($name) {
case 'start_date':
$start = $value;
$startDate = new w2p_Utilities_Date($value);
$rowValues[] = $startDate->format($this->df);
break;
case 'end_date':
$endDate = new w2p_Utilities_Date($value);
$rowValues[] = $endDate->format($this->df);
break;
case 'actual_end':
if ('' == $value) {
$actual_end = $columnValues['end_date'];
$rowValues[] = $value;
} else {
$actual_end = $value;
$actual_endDate = new w2p_Utilities_Date($value);
$rowValues[] = $actual_endDate->format($this->df);
}
break;
default:
$rowValues[] = $value;
}
}
$bar = new GanttBar($this->rowCount++, $rowValues, $start, $actual_end, $caption, $height);
$this->rowMap[$identifier] = $this->rowCount;
$bar->progress->Set(min($progress / 100, 1));
$bar->title->SetFont(FF_CUSTOM, FS_NORMAL, 10);
$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');
$bar->title->SetFont(FF_CUSTOM, FS_BOLD, 9);
}
//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($this->addDependencies($bar, $identifier));
}
示例9: CreateSimple
function CreateSimple($data, $constrains = array(), $progress = array())
{
$num = count($data);
for ($i = 0; $i < $num; ++$i) {
switch ($data[$i][1]) {
case ACTYPE_GROUP:
$a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 8);
$a->title->SetFont($this->iSimpleFont, FS_BOLD, $this->iSimpleFontSize);
$a->rightMark->Show();
$a->rightMark->SetType(MARK_RIGHTTRIANGLE);
$a->rightMark->SetWidth(8);
$a->rightMark->SetColor('black');
$a->rightMark->SetFillColor('black');
$a->leftMark->Show();
$a->leftMark->SetType(MARK_LEFTTRIANGLE);
$a->leftMark->SetWidth(8);
$a->leftMark->SetColor('black');
$a->leftMark->SetFillColor('black');
$a->SetPattern(BAND_SOLID, 'black');
$csimpos = 6;
break;
case ACTYPE_NORMAL:
$a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 10);
$a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
$a->SetPattern($this->iSimpleStyle, $this->iSimpleColor);
$a->SetFillColor($this->iSimpleBkgColor);
$n = count($constrains);
for ($j = 0; $j < $n; ++$j) {
if (empty($constrains[$j]) || count($constrains[$j]) != 3) {
JpGraphError::RaiseL(6003, $j);
}
if ($constrains[$j][0] == $data[$i][0]) {
$a->SetConstrain($constrains[$j][1], $constrains[$j][2], 'black', ARROW_S2, ARROWT_SOLID);
}
}
$n = count($progress);
for ($j = 0; $j < $n; ++$j) {
if (empty($progress[$j]) || count($progress[$j]) != 2) {
JpGraphError::RaiseL(6004, $j);
}
if ($progress[$j][0] == $data[$i][0]) {
$a->progress->Set($progress[$j][1]);
$a->progress->SetHeight(0.5);
$a->progress->SetPattern($this->iSimpleProgressStyle, $this->iSimpleProgressColor);
$a->progress->SetFillColor($this->iSimpleProgressBkgColor);
break;
}
}
$csimpos = 6;
break;
case ACTYPE_MILESTONE:
$a = new MileStone($data[$i][0], $data[$i][2], $data[$i][3]);
$a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
$a->caption->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize);
$csimpos = 5;
break;
default:
die('Unknown activity type');
break;
}
$a->caption->Set($data[$i][$csimpos - 1]);
if (!empty($data[$i][$csimpos])) {
$a->SetCSIMTarget($data[$i][$csimpos]);
$a->SetCSIMAlt($data[$i][$csimpos + 1]);
}
if (!empty($data[$i][$csimpos + 2])) {
$a->title->SetCSIMTarget($data[$i][$csimpos + 2]);
$a->title->SetCSIMAlt($data[$i][$csimpos + 3]);
}
$this->Add($a);
}
}
示例10: CDate
$end = $start;
$caption .= " (no end date)";
} else {
$cap = "";
}
if ($showLabels) {
$caption .= $t['project_name'] . " (" . $t['perc_assignment'] . "%)";
// $caption .= $p['project_active'] <> 0 ? $AppUI->_('active') : $AppUI->_('inactive');
}
if ($t["task_milestone"] != 1) {
$enddate = new CDate($end);
$startdate = new CDate($start);
$bar = new GanttBar($row++, array($name, $startdate->format($df), $enddate->format($df), " "), $start, $actual_end, $cap, 0.6);
// $bar->progress->Set($progress/100);
$bar->title->SetFont(FF_FONT1, FS_NORMAL, 10);
$bar->SetFillColor("#" . $t['project_color_identifier']);
$bar->SetPattern(BAND_SOLID, "#" . $t['project_color_identifier']);
//adding captions
$bar->caption = new TextProperty($caption);
$bar->caption->Align("left", "center");
} else {
$bar = new MileStone($row++, $name, $start, substr($start, 0, 10));
$bar->title->SetColor("#CC0000");
}
$graph2->Add($bar);
// If showAllGant checkbox is checked
}
}
// End of check for valid projects array.
$today = date("y-m-d");
$vline = new GanttVLine($today, $AppUI->_('Today', UI_OUTPUT_RAW));
示例11: grafica
function grafica($fecha_max, $fecha_min, $datos)
{
$graph = new GanttGraph();
$graph->title->Set("");
// Rango de fechas a presentar
$graph->SetDateRange($fecha_min, $fecha_max);
// linea de espaciado vertical entre los elementos
$graph->SetVMarginFactor(2);
// configuracion de colores
$graph->SetMarginColor('lightgreen@0.8');
// color del fondo
$graph->SetBox(true, 'yellow:0.6', 2);
// contorno del marco interior
$graph->SetFrame(true, 'darkgreen', 4);
// contorno del marco exterior
$graph->scale->divider->SetColor('yellow:0.6');
// linea divisora de datos y grafico
$graph->scale->dividerh->SetColor('red:0.6');
//liena que divide el tiempo con las barras de la grafica
// Ponemos la medida de tiempo que queremos usar, por ejemplo años, meses, dias, hors o minutos
//por ejemplo, si queremos solamente la division por meses y semanas en lugar de tener
//GANTT_HWEEK | GANTT_HMONTH | GANTT_HYEAR | GANTT_HDAY
//dejamos
//GANTT_HWEEK | GANTT_HMONTH
// para mas opciones de division de tiempo ver comentarios abajo
$graph->ShowHeaders(GANTT_HWEEK | GANTT_HMONTH | GANTT_HYEAR | GANTT_HDAY);
$graph->scale->month->grid->SetColor('gray');
//lineas verticales que dividen los meses
$graph->scale->month->grid->Show(true);
$graph->scale->year->grid->SetColor('gray');
// linea verticales que dividen los años
$graph->scale->year->grid->Show(true);
$graph->scale->actinfo->SetColTitles(array('Acción', 'Duracion', 'Inicio', 'Final', 'Porcentaje'), array(30, 100));
$graph->scale->actinfo->SetBackgroundColor('blue:0.5@0.5');
//color de fondo de los titulos de la tabla
$graph->scale->actinfo->SetFont(FF_ARIAL, FS_NORMAL, 12);
//tipografia
// division vertical de los datos a la izquierda, posibles valores 'solid', 'dotted', 'dashed'
$graph->scale->actinfo->vgrid->SetStyle('solid');
$graph->scale->actinfo->vgrid->SetColor('red');
// color de las divisiones puestas en el renglon anterior
// Configuración de los iconos que queremos usar
//para poner algun icono no definido podemos usarlo de la siguiente manera
//$icon = new IconImage("imagen.png",0.7);
//en el ejemplo estoy usando una omagen desde blogspot
//el numero que es el segundo parametro de IconImage es el porcentaje de la imagen, en este caso esta al 20%
$erricon = new IconImage("logo-copia.png", 0.2);
$startconicon = new IconImage(GICON_FOLDEROPEN, 0.6);
$endconicon = new IconImage(GICON_TEXTIMPORTANT, 0.5);
//ahora ponemos los datos de la tabla e iniciamos los datos de las barras
// $data = array(
// //valores del arreglo:
// //indice del arreglo, arreglo de datos para la informacion a la izquierda, fecha de inicio de la barra, fecha final de la barra, tipografia, estilo,tamaño tipografia,% de progreso en la barra
// array(0,array("Pre-study","17 days","1 Nov '2011","1 Mar '2012")
// , "2011-11-01","2012-01-1",FF_ARIAL,FS_NORMAL,8, 0.5),//el 0.5 indica el 50%, que ocuparemos en la linea 74, dando su posicion en el arreglo
// array(1,array("Prototype","10 days","26 Oct '2011","16 Nov '2011"),
// "2011-10-26","2011-11-01",FF_ARIAL,FS_NORMAL,8, 0.12),
// array(2,array("Report","12 days","1 Mar '2012","13 Mar '2012"),
// "2012-03-01","2012-03-13",FF_ARIAL,FS_NORMAL,8, 1)
// );
$data = $datos;
// Crea las barras y las añade a la grafica gantt
for ($i = 0; $i < count($data); ++$i) {
$bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], '', 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($data[$i][7]);
// ocupamos el % de adelanto en la actividad
$bar->progress->SetPattern(GANTT_SOLID, "darkgreen");
//$bar->title->SetCSIMTarget(array('#1'.$i,'#2'.$i,'#3'.$i,'#4'.$i,'#5'.$i),array('11'.$i,'22'.$i,'33'.$i));
$graph->Add($bar);
//echo "<br>--> ".$data[$i][7];
}
// Creamos la imagen y le damos nombre, la imagen se guarda donde estan estos archivos
$graph->Stroke('imagenprueba.jpg');
}
示例12: GanttBar
// match the weekend settings ...
$graph->scale->hour->SetFontColor($styles->val('image.session.header.color', 'black', true));
$graph->scale->hour->SetBackgroundColor($styles->val('image.session.header.bgcolor', 'lightyellow:1.5', true));
$graph->scale->hour->SetFont(constant($styles->val('image.session.font', 'FF_FONT0', true)));
$graph->scale->hour->SetIntervall($styles->val('image.session.interval', 2, true));
$graph->scale->hour->SetStyle(constant($styles->val('image.session.header.hourstyle', 'HOURSTYLE_H24', true)));
/**
$graph->scale->actinfo->SetBackgroundColor('lightyellow:1.5');
$graph->scale->actinfo->SetFont(FF_FONT0);
$graph->scale->actinfo->SetColTitles(array(""));
/**/
$show = (bool) $styles->val('image.session.hgrid.show', true, true);
$graph->hgrid->Show($show);
if ($show) {
$graph->hgrid->SetRowFillColor($styles->val('image.session.hgrid.color1', 'whitesmoke@0.9', true), $styles->val('image.session.hgrid.color2', 'darkblue@0.9', true));
}
for ($i = 0; $i < count($data); ++$i) {
$bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3]);
$bar->SetPattern(constant($styles->val('image.session.bar.pattern', 'BAND_RDIAG', true)), $styles->val('image.session.bar.patternfill', 'lightblue', true));
$bar->SetFillColor($styles->val('image.session.bar.fill', 'BAND_SOLID', true));
$shadow = $styles->val('image.session.bar.shadow', '', true);
if ($shadow) {
$bar->SetShadow(true, $shadow);
}
$graph->Add($bar);
}
$graph->SetVMarginFactor($styles->val('image.session.bar.vmargin', 0.4, true));
if ($styles->val('image.session.showfooter', 'image.common.footer.show')) {
stdImgFooter($graph);
}
$graph->Stroke();
示例13: 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);
}
示例14: makeNormalbar
/**
* @param $task Task
* @param $start_date string
* @param $end_date string
* @param $position int
* @return GanttBar
*
* Creates a normal GanttBar for a task, and adds an overlay showing the current progress
* @todo make colours themeable
*/
private function makeNormalbar(Task $task, $start_date, $end_date, $position)
{
$bar = new GanttBar($position, $task->name, $start_date, $end_date, $task->getField('duration')->formatted, 15);
$bar->setPattern(BAND_SOLID, '#0077BD');
$bar->SetFillColor('#0077BD');
$bar->progress->Set($task->progress / 100);
$bar->progress->SetPattern(BAND_RDIAG, '#0077BD', 70);
$bar->progress->SetFillColor('#ffffff');
$bar->setShadow();
return $bar;
}
示例15: array
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
// Change the scale font
$graph->scale->week->SetFont(FF_FONT0);
$graph->scale->year->SetFont(FF_ARIAL, FS_BOLD, 12);
// Setup some data for the gantt bars
$data = array(array(0, "Group 1", "2001-10-29", "2001-11-27", FF_FONT1, FS_BOLD, 8), array(1, " Label 2", "2001-11-8", "2001-12-14"), array(2, " Label 3", "2001-11-01", "2001-11-8"), array(4, "Group 2", "2001-11-07", "2001-12-19", FF_FONT1, FS_BOLD, 8), array(5, " Label 4", "2001-11-8", "2001-12-19"), array(6, " Label 5", "2001-11-01", "2001-11-8"));
for ($i = 0; $i < count($data); ++$i) {
$bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], "[50%]", 0.5);
if (count($data[$i]) > 4) {
$bar->title->SetFont($data[$i][4], $data[$i][5], $data[$i][6]);
}
// If you like each bar can have a shadow
// $bar->SetShadow(true,"darkgray");
// For illustration lets make each bar be red with yellow diagonal stripes
$bar->SetPattern(BAND_RDIAG, "yellow");
$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();