本文整理汇总了PHP中GanttGraph::SetDateRange方法的典型用法代码示例。如果您正苦于以下问题:PHP GanttGraph::SetDateRange方法的具体用法?PHP GanttGraph::SetDateRange怎么用?PHP GanttGraph::SetDateRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GanttGraph
的用法示例。
在下文中一共展示了GanttGraph::SetDateRange方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GanttGraph
<?php
// Gantt example
include "../jpgraph.php";
include "../jpgraph_gantt.php";
$graph = new GanttGraph();
$graph->title->Set("Only month & year scale");
// 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)
$graph->SetDateRange('2001-10-06', '2002-4-10');
// Display month and year scale with the gridlines
$graph->ShowHeaders(GANTT_HMONTH | GANTT_HYEAR);
$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 activity info
// For the titles we also add a minimum width of 100 pixels for the Task name column
$graph->scale->actinfo->SetColTitles(array('Name', 'Duration', 'Start', 'Finish'), array(100));
$graph->scale->actinfo->SetBackgroundColor('green:0.5@0.5');
$graph->scale->actinfo->SetFont(FF_ARIAL, FS_NORMAL, 10);
$graph->scale->actinfo->vgrid->SetStyle('solid');
$graph->scale->actinfo->vgrid->SetColor('gray');
// Data for our example activities
$data = array(array(0, array("Pre-study", "102 days", "23 Nov '01", "1 Mar '02"), "2001-11-23", "2002-03-1", FF_ARIAL, FS_NORMAL, 8), array(1, array("Prototype", "21 days", "26 Oct '01", "16 Nov '01"), "2001-10-26", "2001-11-16", FF_ARIAL, FS_NORMAL, 8), array(2, array("Report", "12 days", "1 Mar '02", "13 Mar '02"), "2002-03-01", "2002-03-13", FF_ARIAL, FS_NORMAL, 8));
示例2: GanttGraph
<?php
// content="text/plain; charset=utf-8"
// $Id: ganttex_slice.php,v 1.2 2002/07/11 23:27:28 aditus Exp $
// Gantt example with sunday week start and only shows a partial graph
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_gantt.php';
// Setup Gantt graph
$graph = new GanttGraph(0, 0, 'auto');
$graph->SetShadow();
$graph->SetBox();
// Only show part of the Gantt
$graph->SetDateRange('2001-11-22', '2002-1-24');
// Weeks start on Sunday
$graph->scale->SetWeekStart(0);
$graph->title->Set("General conversion plan");
$graph->subtitle->Set("(Slice between 2001-11-22 to 2002-01-24)");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 20);
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->week->SetFont(FF_FONT1);
$data = array(array(0, "Group 1\tJohan", "2002-1-23", "2002-01-28", FF_FONT1, FS_BOLD, 8), array(1, " Label 2", "2001-10-26", "2001-11-16"), array(2, " Label 3", "2001-11-30", "2001-12-01"), array(4, "Group 2", "2001-11-30", "2001-12-22", FF_FONT1, FS_BOLD, 8), array(5, " Label 4", "2001-11-30", "2001-12-1"), array(6, " Label 5", "2001-12-6", "2001-12-8"), array(8, " Label 8", "2001-11-30", "2002-01-02"));
// make up some fictionary activity bars
for ($i = 0; $i < count($data); ++$i) {
$bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], "[5%]", 10);
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);
示例3: GanttGraph
//$showTaskGantt = dPgetParam($_GET, 'showTaskGantt', '0');
$graph = new GanttGraph($width);
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->SetFrame(false);
$graph->SetBox(true, array(0, 0, 0), 2);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$pLocale = setlocale(LC_TIME, 0);
// get current locale for LC_TIME
$res = @setlocale(LC_TIME, $AppUI->user_lang[0]);
if ($res) {
// Setting locale doesn't fail
$graph->scale->SetDateLocale($AppUI->user_lang[0]);
}
setlocale(LC_TIME, $pLocale);
if ($start_date && $end_date) {
$graph->SetDateRange($start_date, $end_date);
}
$graph->scale->actinfo->SetFont(FF_CUSTOM, FS_NORMAL, 8);
$graph->scale->actinfo->vgrid->SetColor('gray');
$graph->scale->actinfo->SetColor('darkgray');
$graph->scale->actinfo->SetColTitles(array($AppUI->_('Project name', UI_OUTPUT_RAW), $AppUI->_('Start Date', UI_OUTPUT_RAW), $AppUI->_('Finish', UI_OUTPUT_RAW), $AppUI->_('Actual End', UI_OUTPUT_RAW)), array(160, 70, 70, 70));
$tableTitle = $proFilter == '-1' ? $AppUI->_('All Projects') : $projectStatus[$proFilter];
$graph->scale->tableTitle->Set($tableTitle);
// Use TTF font if it exists
// try commenting out the following two lines if gantt charts do not display
if (is_file(TTF_DIR . 'FreeSansBold.ttf')) {
$graph->scale->tableTitle->SetFont(FF_CUSTOM, FS_BOLD, 12);
}
$graph->scale->SetTableTitleBackground('#EEEEEE');
$graph->scale->tableTitle->Show(true);
//-----------------------------------------
示例4: graficar
//.........这里部分代码省略.........
if (isset($dataset[$i]['etapa']) && $dataset[$i]['etapa'] != '') {
$desc_principal = ' ' . $dataset[$i]['etapa'] . ' [' . trim($desc_principal) . ']';
}
//mostramos cuenta de usuario si existe
if ($dataset[$i]['nombre_usuario_ai'] != '' && $dataset[$i]['nombre_usuario_ai'] != 'NULL') {
$desc_principal = $desc_principal . ' (por AI: ' . $dataset[$i]['nombre_usuario_ai'] . ")";
} elseif ($dataset[$i]['cuenta'] != '') {
$desc_principal = $desc_principal . ' (por: ' . $dataset[$i]['cuenta'] . ")";
}
if ($dataset[$i]['disparador'] == 'no' && $dataset[$i]['estado_reg'] == 'activo' || $dataset[$i]['tipo'] == 'estado_final') {
$desc_principal = $desc_principal . ' *****';
}
$cabecera = array(utf8_decode($desc_principal), utf8_decode($resp), $tiempo, $fini, $ffin);
array_push($actividad, $tipo);
array_push($actividad, $cabecera);
array_push($actividad, $fecha_reg_ini->format('Y-m-d H:i:s'));
if ($dataset[$i]['tipo'] != 'estado_final') {
array_push($actividad, $fecha_reg_fin->format('Y-m-d H:i:s'));
}
array_push($actividad, utf8_decode($dataset[$i]['descripcion']));
array_push($actividad, '#' . $dataset[$i]['id']);
array_push($actividad, $fecha_reg_ini->format('Y-m-d H:i:s'));
//prepara las relaciones entre tipos
if ($dataset[$i]['tipo'] == 'estado' && $dataset[$i]['id_siguiente'] != 0) {
array_push($constrains, array($dataset[$i]['id'], $dataset[$i]['id_siguiente'], CONSTRAIN_ENDSTART));
}
array_push($data, $actividad);
}
//definir scala en funcion al dia inicial y dia final
$diferencia = $fechaInicio->diff($fechaFin);
if ($diferencia->format('%m') >= 24) {
//escala de meses
$graph->ShowHeaders(GANTT_HYEAR);
$sw = 1;
$fechaFin = $fechaFin->add(new DateInterval('PT9000H'));
} elseif ($diferencia->format('%m') >= 7) {
//escala de meses
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH);
$sw = 1;
$fechaFin = $fechaFin->add(new DateInterval('PT29000H'));
} elseif ($diferencia->format('%m') > 6) {
//escala de meses
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH);
$graph->scale->week->SetStyle(HOURSTYLE_HM24);
$sw = 1;
$fechaFin = $fechaFin->add(new DateInterval('PT6000H'));
} elseif ($diferencia->format('%m') > 1) {
//escala de semanas
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HWEEK);
$graph->scale->week->SetStyle(HOURSTYLE_HM24);
$sw = 2;
$fechaFin = $fechaFin->add(new DateInterval('PT7000H'));
} elseif ($diferencia->format('%m') > 0) {
//escala de dias
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HWEEK | GANTT_HDAY);
$graph->scale->week->SetStyle(HOURSTYLE_HM24);
$sw = 3;
$fechaFin = $fechaFin->add(new DateInterval('PT4600H'));
} elseif ($diferencia->format('%m') == 0 && $diferencia->format('%d') > 1) {
//escala de dias
$graph->ShowHeaders(GANTT_HMONTH | GANTT_HWEEK | GANTT_HDAY | GANTT_HHOUR);
$graph->scale->week->SetStyle(HOURSTYLE_HM24);
$graph->scale->hour->SetInterval(12);
$sw = 4;
$fechaFin = $fechaFin->add(new DateInterval('PT400H'));
} else {
//escala de horas
$graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR);
$graph->scale->week->SetStyle(HOURSTYLE_HM24);
$fechaFin = $fechaFin->add(new DateInterval('PT250H'));
$sw = 5;
}
$graph->scale->actinfo->SetColTitles(array('Tipo', 'Responsable', 'Duracion', 'Inicio', 'Fin'), array(40, 100));
// Setup a horizontal grid
$graph->hgrid->Show();
$graph->hgrid->SetRowFillColor('darkblue@0.9');
$graph->SetDateRange($fechaInicio->format('Y-m-d H:i:s'), $fechaFin->format('Y-m-d H:i:s'));
//$graph->SetDateRange('2013-06-04','2013-08-04');
$graph->title->Set("Diagrama Gant Work Flow");
//$graph->scale->week->SetStyle(MINUTESTYLE_MM);
$graph->scale->week->SetFont(FF_FONT1);
$progress = array();
$graph->CreateSimple($data, $constrains, $progress);
$archivo = dirname(__FILE__) . '/../../../reportes_generados/' . $filename;
//$graph->StrokeCSIM();
$graph->Stroke($archivo);
/*
echo ('<pre>');
var_dump($sw);
var_dump($fechaInicio->format('Y-m-d H:i:s'));
var_dump($fechaFin->format('Y-m-d H:i:s'));
var_dump($data);
echo ('</pre>');
echo ('<pre>');
print_r($constrains);
echo ('</pre>');*/
}
示例5: GanttGraph
// content="text/plain; charset=utf-8"
// Gantt example
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_gantt.php";
$graph = new GanttGraph();
$graph->title->Set("Adding a spaning title");
// 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)
$graph->SetDateRange('2001-11-06', '2002-1-10');
// Display month and year scale with the gridlines
$graph->ShowHeaders(GANTT_HMONTH | GANTT_HYEAR | GANTT_HWEEK);
$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 spanning title
$graph->scale->tableTitle->Set('Phase 1');
$graph->scale->tableTitle->SetFont(FF_ARIAL, FS_NORMAL, 16);
$graph->scale->SetTableTitleBackground('darkgreen@0.6');
$graph->scale->tableTitle->Show(true);
// 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('Name', 'Duration', 'Start', 'Finish'), array(100));
$graph->scale->actinfo->SetBackgroundColor('green:0.5@0.5');
示例6: 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');
}
示例7: DEFINE
/**
* creates the image for the gantt chart
*
* @param $_params array containing projectdata, start- and enddate
* @param $_filename filename for the image, if empty image gets printed to browser
* @author Lars Kneschke / Bettina Gille
* @returns nothing - writes image to disk
*/
function show_graph($params, $_filename = '')
{
$modernJPGraph = false;
// no gd support
if (!function_exists('imagecopyresampled')) {
return false;
}
DEFINE("TTF_DIR", PHPGW_SERVER_ROOT . "/projects/ttf-bitstream-vera-1.10/");
if (file_exists(PHPGW_SERVER_ROOT . '/../jpgraph/src/jpgraph.php')) {
include PHPGW_SERVER_ROOT . '/../jpgraph/src/jpgraph.php';
include PHPGW_SERVER_ROOT . '/../jpgraph/src/jpgraph_gantt.php';
} else {
include PHPGW_SERVER_ROOT . '/projects/inc/jpgraph-1.5.2/src/jpgraph.php';
include PHPGW_SERVER_ROOT . '/projects/inc/jpgraph-1.5.2/src/jpgraph_gantt.php';
}
//_debug_array($params);
$project_array = $params['project_array'];
$sdate = $params['sdate'];
$edate = $params['edate'];
$showMilestones = $params['showMilestones'];
$showResources = $params['showResources'];
$bocalendar = CreateObject('calendar.bocalendar');
$this->graph = CreateObject('phpgwapi.gdgraph', $this->debug);
$bolink = CreateObject('infolog.bolink');
//$this->boprojects->order = 'parent';
$this->boprojects->limit = False;
$this->boprojects->html_output = False;
if (is_array($project_array)) {
$projects = array();
foreach ($project_array as $pro) {
$project = $this->boprojects->list_projects(array('action' => 'mainsubsorted', 'project_id' => $pro, 'mstones_stat' => True));
if (is_array($project)) {
$i = count($projects);
for ($k = 0; $k < count($project); $k++) {
$projects[$i + $k] = $project[$k];
}
}
}
}
if (is_array($projects)) {
$modernJPGraph = version_compare('1.13', JPG_VERSION);
$sdate = $sdate + 60 * 60 * $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
$sdateout = $GLOBALS['phpgw']->common->show_date($sdate, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
$edate = $edate + 60 * 60 * $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
$edateout = $GLOBALS['phpgw']->common->show_date($edate, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
# $this->graph->title = lang('Gantt chart from %1 to %2',$sdateout,$edateout);
// Standard calls to create a new graph
if ($modernJPGraph) {
$graph = new GanttGraph(940, -1, "auto");
} else {
$graph = new GanttGraph(-1, -1, "auto");
}
$graph->SetShadow();
$graph->SetBox();
$duration = $edate - $sdate;
if ($duration < 5958000) {
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
if ($modernJPGraph) {
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAYWNBR);
} else {
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
}
} elseif ($duration < 13820400) {
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HWEEK);
} else {
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH);
}
// For the week we choose to show the start date of the week
// the default is to show week number (according to ISO 8601)
#$graph->scale->SetDateLocale('de_DE');
// Change the scale font
$graph->scale->week->SetFont(FF_VERA, FS_NORMAL, 8);
$graph->scale->year->SetFont(FF_VERA, FS_BOLD, 10);
// Titles for chart
$graph->title->Set(lang('project overview'));
$graph->subtitle->Set(lang('from %1 to %2', $sdateout, $edateout));
$graph->title->SetFont(FF_VERA, FS_BOLD, 12);
$graph->subtitle->SetFont(FF_VERA, FS_BOLD, 10);
// set the start and end date
// add one day to the end is needed internaly by jpgraph
$graph->SetDateRange(date('Y-m-d 00:00:00', $sdate), date('Y-m-d', $edate + 86400));
foreach ($projects as $pro) {
$ptime_pro = $this->boprojects->return_value('ptime', $pro[project_id]);
$acc = $this->boprojects->get_budget(array('project_id' => $pro[project_id], 'ptime' => $ptime_pro));
if ($ptime_pro > 0) {
$finnishedPercent = 100 / $ptime_pro * $acc[uhours_jobs_wminutes];
} else {
$finnishedPercent = 0;
}
$previous = '';
if ($pro['previous'] > 0) {
//.........这里部分代码省略.........
示例8: elseif
$graph->scale->actinfo->SetBackgroundColor('green:0.5@0.5');
$graph->scale->actinfo->SetFont(FF_VERA, FS_NORMAL, 10);
$graph->scale->actinfo->vgrid->SetStyle('solid');
$graph->scale->actinfo->vgrid->SetColor('gray');
if ($epocdate2 - $epocdate1 > 12000000) {
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH);
$graph->scale->month->grid->SetColor('gray');
$graph->scale->month->grid->Show(true);
$graph->scale->year->grid->SetColor('gray');
$graph->scale->year->grid->Show(true);
} elseif ($epocdate2 - $epocdate1 > 6000000) {
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->week->SetFont(FF_FONT1);
} else {
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->week->SetFont(FF_FONT1);
}
$graph->img->SetImgFormat('jpeg');
$graph->img->SetQuality(100);
$graph->SetShadow();
$graph->SetFrame(true, 'black', 2);
$graph->SetDateRange($gdate1, $gdate2);
$row = 1;
// Draw all projects - recursive function
prj_drawProjectGanttBar($graph, $row, $count, 0, '', $_COOKIE['showMonitor'], $_COOKIE['showTeamMember']);
// Draw final Chart
$_REQUEST['faketime'] = time();
//this is added here to ensure that the image is NEVER cached by FF or IE
$graph->StrokeCSIM('projects_gantt.php');
示例9: CDate
$graph->scale->SetTableTitleBackground('#'.$projects[$project_id]['project_color_identifier']);
$graph->scale->tableTitle->Show(true);
}
*/
//-----------------------------------------
// nice Gantt image
// if diff(end_date,start_date) > 90 days it shows only
//week number
// if diff(end_date,start_date) > 240 days it shows only
//month number
//-----------------------------------------
if ($start_date_g && $end_date_g) {
//need to use start_date_g so that the date is set outside the loop, otherwise it fails seting range on second pass
$min_d_start = new CDate($start_date_g);
$max_d_end = new CDate($end_date_g);
$graph->SetDateRange($start_date_g, $end_date_g);
} else {
// find out DateRange from gant_arr
$d_start = new CDate();
$d_end = new CDate();
for ($i = 0; $i < count(@$gantt_arr); $i++) {
$a = $gts[$i][0];
$start = substr($a['task_start_date'], 0, 10);
$end = substr($a['task_end_date'], 0, 10);
$d_start->Date($start);
$d_end->Date($end);
if ($i == 0) {
$min_d_start = $d_start;
$max_d_end = $d_end;
} else {
if (CDate::compare($min_d_start, $d_start) > 0) {
示例10: 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;
}
示例11: gantt_chart
//.........这里部分代码省略.........
$t_activity_main->SetPattern(BAND_RDIAG, get_status_color(bug_get_field($t_bug_id, 'status')));
}
$t_activity_main->SetFillColor(get_status_color(bug_get_field($t_bug_id, 'status')));
$t_activity_main->title->SetFont($t_graph_font, FS_NORMAL, 8);
// Set the constraint if any...
foreach ($t_constraints as $t_constraint) {
// ... and if possible
if (in_array($t_constraint['row'], $t_row_list)) {
$t_activity_main->SetConstrain($t_constraint['row'], $t_constraint['type']);
}
}
$graph->add($t_activity_main);
}
if (null != $t_activity_arr['right']) {
$t_activity_right = new GanttBar($t_activity_arr['right']['row'], $t_activity_arr['right']['label'], graph_date_format($t_activity_arr['right']['start']), graph_date_format($t_activity_arr['right']['end']), $t_activity_arr['right']['info']);
// Add a left marker
$t_activity_right->rightMark->Show();
$t_activity_right->rightMark->SetType(MARK_FILLEDCIRCLE);
$t_activity_right->rightMark->SetWidth(8);
$t_activity_right->rightMark->SetColor('red');
$t_activity_right->rightMark->SetFillColor('red');
$t_activity_right->rightMark->title->Set('');
$t_activity_right->rightMark->title->SetFont($t_graph_font, FS_NORMAL, 8);
$t_activity_right->rightMark->title->SetColor('white');
if (null != gantt_get_resolution_date($t_bug_id)) {
$t_activity_right->SetPattern(BAND_RDIAG, get_status_color(bug_get_field($t_bug_id, 'status')));
}
$t_activity_right->SetFillColor(get_status_color(bug_get_field($t_bug_id, 'status')));
}
if (isset($t_activity_left)) {
$graph->add($t_activity_left);
}
if (isset($t_activity_right)) {
$graph->add($t_activity_right);
}
break;
case ACTYPE_MILESTONE:
$t_size = 5;
if ($t_start_date < $t_range['min']) {
$t_extra = "(<-- " . graph_date_format($t_start_date) . ")" . $t_extra;
$t_start_date = $t_range['min'];
$t_size = 8;
} else {
if ($t_range['max'] < $t_start_date) {
$t_extra = "(--> " . graph_date_format($t_start_date) . ")" . $t_extra;
$t_start_date = $t_range['max'];
$t_size = 8;
}
}
$t_milestone = new MileStone($t_row, $t_row_label, graph_date_format($t_start_date), $t_extra);
$t_milestone->title->SetFont($t_graph_font, FS_NORMAL, 8);
$t_milestone->mark->SetType(MARK_FILLEDCIRCLE);
$t_milestone->mark->SetWidth($t_size);
if (5 != $t_size) {
$t_milestone->mark->SetFillColor('red');
}
// foreach( $t_constraints as $t_constraint){
// $t_milestone->SetConstrain( $t_constraint['row'], $t_constraint['type'] );
// }
$graph->add($t_milestone);
break;
}
}
// Setting the min and max date:
$t_minmax = $graph->GetBarMinMax();
$t_week_in_seconds = 7 * 24 * 3600;
// 1 week offset min:
if ($t_minmax[0] - $t_week_in_seconds > 0) {
$t_graph_offset_min = $t_minmax[0] - $t_week_in_seconds;
} else {
$t_graph_offset_min = $t_minmax[0];
}
// 2 weeks offset max:
$t_graph_offset_max = $t_minmax[1] + 3 * $t_week_in_seconds;
$graph->SetDateRange(graph_date_format($t_graph_offset_min), graph_date_format($t_graph_offset_max));
// Add a vertical line for today if in the range of GetBarMinMax() (retruns an arry ($min, $max) ):
$t_minmax = $graph->GetBarMinMax();
$t_now = date(config_get('short_date_format'));
if ($t_now >= graph_date_format($t_graph_offset_min) && $t_now <= graph_date_format($t_graph_offset_max)) {
$t_today = new GanttVLine($t_now, "Today", "darkred", 2, "solid");
$t_today->SetDayOffset(0.5);
$graph->add($t_today);
}
// $t_today = new GanttVLine( "2011-03-01" , "" , "darkred", 2, "solid");//
// $t_today->SetDayOffset(0.5);
// $graph->add( $t_today );
$t_gantt_chart_height = gantt_chart_get_height($graph);
$t_legend = gantt_chart_legend(false);
$t_legend_height = 60;
// Display the Gantt chart
// $graph->Stroke();
//--------------------------------------
// Create a combined graph
//--------------------------------------
$mgraph = new MGraph();
$mgraph->Add($graph, 0, 0);
$mgraph->Add($t_legend, 0, $t_gantt_chart_height + $t_legend_height);
$mgraph->Stroke();
}
}
示例12: date
$due = date("Y-m-d", dateutil::arr2stamp($deliverables[$i]["duedate"]));
$ms = new MileStone(count($gant) + $i, $deliverables[$i]["name"], $due, $due . " (" . $deliverables[$i]["name"] . ")");
$graph->Add($ms);
}
// dependencies
for ($i = 0, $_i = count($dbrecordsdep); $i < $_i; $i++) {
$activity[$reverselookup[$dbrecordsdep[$i]["dependency_phaseid_row"]]]->SetConstrain($reverselookup[$dbrecordsdep[$i]["dependency_phaseid_col"]], CONSTRAIN_ENDSTART);
}
for ($i = 0, $_i = count($activity); $i < $_i; $i++) {
$graph->Add($activity[$i]);
}
//TO DO: find a good solution for errorhandling
//here you can set a subtitle
//$graph->subtitle->Set('title');
if (count($gant) == 0) {
$graph->SetDateRange(time(), time() + 86400);
}
//Add only a vertical line with the actual date when this actual date is between the start- and enddate of the project
$startdateproject = "";
$enddateproject = "";
foreach ($gant as $phase) {
if (isset($phase["startdate"]) && ($phase["startdate"] < $startdateproject || $startdateproject == "")) {
$startdateproject = $phase["startdate"];
}
if (isset($phase["enddate"]) && ($phase["enddate"] > $enddateproject || $enddateproject == "")) {
$enddateproject = $phase["enddate"];
}
}
if ($startdateproject <= date("Y-m-d") and $enddateproject >= date("Y-m-d")) {
$vline = new GanttVLine(date("Y-m-d"), date("d-m-Y"));
$vline->SetDayOffset(0.5);