本文整理汇总了PHP中GanttGraph::SetShadow方法的典型用法代码示例。如果您正苦于以下问题:PHP GanttGraph::SetShadow方法的具体用法?PHP GanttGraph::SetShadow怎么用?PHP GanttGraph::SetShadow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GanttGraph
的用法示例。
在下文中一共展示了GanttGraph::SetShadow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GanttGraph
<?php
include "../jpgraph.php";
include "../jpgraph_gantt.php";
$graph = new GanttGraph(0, 0, "auto");
$graph->SetBox();
$graph->SetShadow();
// Add title and subtitle
$graph->title->Set("Example of captions");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$graph->subtitle->Set("(ganttex14.php)");
// Show day, week and month scale
$graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
// Use the short name of the month together with a 2 digit year
// 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);
// Format the bar for the first activity
// ($row,$title,$startdate,$enddate)
$activity = new GanttBar(0, "Project", "2001-12-21", "2002-01-07", "[50%]");
// Yellow diagonal line pattern on a red background
$activity->SetPattern(BAND_RDIAG, "yellow");
$activity->SetFillColor("red");
// Set absolute height
$activity->SetHeight(10);
// Specify progress to 60%
$activity->progress->Set(0.6);
// Format the bar for the second activity
示例2: graficar
public function graficar($filename)
{
$graph = new GanttGraph();
$graph->SetShadow();
$graph->SetBox();
$dataset = $this->dataSource->getDataset();
define('UTF-8', $locale_char_set);
$tamanioDataset = count($dataset);
$fecha_reg_ini = new DateTime();
$fecha_reg_fin = new DateTime();
$fechaInicio = new DateTime();
$fechaFin = new DateTime();
$data = array();
$constrains = array();
for ($i = 0; $i < $tamanioDataset; $i++) {
//echo date_format(new DateTime($dataset[$i]['fecha_ini']),'Y-m-d H:i:s');
//exit;
if ($i == 0) {
$fechaInicio = new DateTime($dataset[$i]['fecha_ini']);
$fechaFin = new DateTime($dataset[$i]['fecha_fin']);
}
if ($fechaFin < new DateTime($dataset[$i]['fecha_ini']) && $dataset[$i]['tipo'] == 'estado_final') {
$fechaFin = new DateTime($dataset[$i]['fecha_ini']);
}
$actividad = array();
array_push($actividad, $dataset[$i]['id']);
$prefijo = '';
if ($dataset[$i]['tipo'] == 'proceso') {
$tipo = ACTYPE_GROUP;
}
if ($dataset[$i]['tipo'] == 'estado') {
$tipo = ACTYPE_NORMAL;
$prefijo = ' ';
}
if ($dataset[$i]['tipo'] == 'obs') {
$tipo = ACTYPE_NORMAL;
$prefijo = ' ';
}
if ($dataset[$i]['tipo'] == 'estado_final') {
$tipo = ACTYPE_MILESTONE;
$prefijo = ' ';
}
//arma cabecera
$fecha_reg_ini = new DateTime($dataset[$i]['fecha_ini']);
$fecha_reg_fin = new DateTime($dataset[$i]['fecha_fin']);
$resp = $dataset[$i]['funcionario'] != '' ? $dataset[$i]['funcionario'] : $dataset[$i]['depto'];
$resp = $resp == '' ? $dataset[$i]['cuenta'] : $resp;
//$resp = $dataset[$i]['depto'].'('.$dataset[$i]['cuenta'].") ->".$dataset[$i]['funcionario'];
//$resp = $dataset[$i]['depto'].'('.$dataset[$i]['cuenta'].");
$fini = $fecha_reg_ini->format('d M H:i:s');
$ffin = $fecha_reg_fin->format('d M H:i:s');
$start = strtotime($dataset[$i]['fecha_ini']);
$end = strtotime($dataset[$i]['fecha_fin']);
$days_between = round(($end - $start) / 86400);
if ($dataset[$i]['tipo'] == 'obs') {
$desc_principal = utf8_decode($prefijo . ' -> OBS: ' . $dataset[$i]['nombre']);
} else {
$desc_principal = utf8_decode($prefijo . $dataset[$i]['nombre']);
}
if ($dataset[$i]['tipo'] == 'estado' || $dataset[$i]['tipo'] == 'obs') {
$tiempo = $days_between . ' dias';
} else {
if ($dataset[$i]['tipo'] == 'estado_final') {
$tiempo = '--';
$ffin = $fini;
} else {
$resp = '--';
$tiempo = $days_between . ' dias';
$desc_principal = $desc_principal . "\n" . $dataset[$i]['descripcion'];
}
}
// si el estado tiene configurado el nombre de estapa damos preferencia a este campo
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);
}
//.........这里部分代码省略.........
示例3: 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) {
//.........这里部分代码省略.........
示例4: 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);
}
示例5: 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;
}
示例6: gantt_chart
function gantt_chart($p_metrics, $p_title, $p_subtitle, $p_graph_width = 300, $p_graph_height = 380)
{
$t_graph_font = graph_get_font();
$t_metrics = $p_metrics['metrics'];
$t_range = $p_metrics['range'];
// Diff in weeks of the range:
$t_60s = 60;
// 1 minute
$t_60min = 60;
// 1 hour
$t_24h = 24;
// 1 day
$t_7d = 7;
// 1 week
$t_minute = $t_60s;
$t_hour = $t_60min * $t_minute;
$t_day = $t_24h * $t_hour;
$t_week = $t_7d * $t_day;
$t_gantt_chart_max_rows = plugin_config_get('rows_max');
error_check(is_array($t_metrics) ? count($t_metrics) : 0, $p_title . " (" . $p_subtitle . ")");
if (plugin_config_get('eczlibrary') == ON) {
// DO NOTHING SINCE eczlibrary DOES NOT SUPPORT GANTT CHART
} else {
// A new graph with automatic size
$graph = new GanttGraph(0, 0, "auto");
$graph->SetShadow();
// Add title and subtitle
$graph->title->Set($p_title);
$graph->title->SetFont($t_graph_font, FS_BOLD, 12);
$graph->subtitle->Set($p_subtitle);
// Show day, week and month scale
$graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
// Instead of week number show the date for the first day in the week
// on the week scale
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
// Make the week scale font smaller than the default
$graph->scale->week->SetFont($t_graph_font, FS_NORMAL, 8);
// Use the short name of the month together with a 2 digit year
// on the month scale
$graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR4);
$graph->scale->month->SetFontColor("white");
$graph->scale->month->SetBackgroundColor("blue");
// Setup a horizontal grid
$graph->hgrid->Show();
$graph->hgrid->SetRowFillColor('darkblue@0.9');
// Setup a vertical grid
// $graph->vgrid->Show();
//Setup the divider display
$graph->scale->divider->SetWeight(3);
$graph->scale->divider->SetColor("darkblue");
$graph->scale->dividerh->SetWeight(3);
$graph->scale->dividerh->SetColor("darkblue");
$graph->scale->dividerh->Show();
$graph->scale->actinfo->vgrid->SetStyle('solid');
$graph->scale->actinfo->vgrid->SetColor('darkblue');
$graph->scale->actinfo->vgrid->Show();
// // Set the column headers and font
// $graph->scale->actinfo->SetColTitles( array('Task','Start','End'),array(100));
// $graph->scale->actinfo->SetFont( $t_graph_font, FS_BOLD, 10 );
//Adding columns:
//The following is an example: 1st element, an array of the columns,
// 2nd element an optional array of min width of the columns (here the min width of the 2 first columns)
//$graph->scale->actinfo->SetColTitles(
// array('Note','Task','Duration','Start','Finish'),array(30,100));
//Adding a table title
$graph->scale->tableTitle->Set("{$p_subtitle}");
$graph->scale->tableTitle->SetFont($t_graph_font, FS_NORMAL, 8);
$graph->scale->SetTableTitleBackground('darkblue@0.6');
$graph->scale->tableTitle->Show();
// if ( null != $t_constrain ){
// $t_activity->SetConstrain( $t_constrain, CONSTRAIN_ENDSTART );
// }
// if ( null != $t_constrain ){
// $t_activity->SetConstrain( $t_constrain['row'], $t_constrain['type'] );
// }
// We first need to get the list of rows, in order to know whether to
// display the constraint or not (in case of missing referenced row)
$t_row_list = array();
foreach ($t_metrics as $t_metric_row) {
$t_row_list[] = $t_metric_row[0];
}
foreach ($t_metrics as $t_metric_row) {
$t_row = $t_metric_row[0] % $t_gantt_chart_max_rows;
$t_activity_type = $t_metric_row[1];
$t_bug_id = $t_metric_row[2];
$t_start_date = $t_metric_row[3];
$t_end_date = $t_metric_row[4];
$t_extra = " {$t_bug_id}" . $t_metric_row[5];
$t_level = $t_metric_row[6];
$t_constraints = $t_metric_row[7];
if (isset($t_level)) {
$t_row_label = utf8_str_pad('', $t_level * 2, ' ') . htmlspecialchars_decode(bug_format_summary($t_bug_id, SUMMARY_FIELD));
} else {
$t_row_label = htmlspecialchars_decode(bug_format_summary($t_bug_id, SUMMARY_FIELD));
}
// Limit the label to max defined
$t_row_label = strlen($t_row_label) > plugin_config_get('label_max') ? substr($t_row_label, 0, plugin_config_get('label_max') - 3) . '...' : $t_row_label;
$t_activity_arr = array('left' => null, 'main' => array('row' => $t_row, 'label' => $t_row_label, 'start' => $t_start_date, 'end' => $t_end_date, 'info' => $t_extra), 'right' => null);
if ($t_end_date < $t_range['min']) {
// complete left bar
//.........这里部分代码省略.........