/** * Display the graph * * @return void */ function display() { $this->prepareGraph(); //init x axis for advanced search display per month if ($this->filter == 'month') { if ($this->advsrch == 2) { $this->minmonth = $this->minmonth - 1; $this->maxmonth = $this->maxmonth - 1; $dateLocale = new DateLocale(); $months = $dateLocale->GetShortMonth(); for ($y = $this->minyear; $y <= $this->maxyear; $y++) { $minm = 1; if ($y == $this->minyear) { $minm = $this->minmonth; } $maxm = 12; if ($y == $this->maxyear) { $maxm = $this->maxmonth; } for ($m = $minm; $m <= $maxm; $m++) { $databarx[] = $months[$m % 12]; } } $this->graph->xaxis->SetTickLabels($databarx); } else { $dateLocale = new DateLocale(); $allmonths = $dateLocale->GetMonth(); $this->graph->xaxis->SetTickLabels($allmonths); } } elseif ($this->advsrch == 3) { for ($y = $this->minyear; $y <= $this->maxyear; $y++) { $minm = 1; if ($y == $this->minyear) { $minm = $this->minmonth; } $maxm = 12; if ($y == $this->maxyear) { $maxm = $this->maxmonth; } for ($m = $minm; $m <= $maxm; $m++) { $mind = 1; if ($m == $minm && $y == $this->minyear) { $mind = $this->minday; } $maxd = date('t', mktime(0, 0, 0, $m, 1, $y)); if ($m == $maxm && $y == $this->maxyear) { $maxd = $this->maxday; } for ($d = $mind; $d <= $maxd; $d++) { if ($d == 1) { $databarx[] = $d . '/' . date('F', mktime(0, 0, 0, $m, $d, $y)); } elseif ($d % 5 == 0) { $databarx[] = $d; } else { $databarx[] = ''; } } } } $this->graph->xaxis->SetLabelAngle(90); $this->graph->xaxis->SetTickLabels($databarx); } $this->graph->Stroke(); }
<?php // content="text/plain; charset=utf-8" // Gantt example require_once 'login.php'; //ini_set('intl.default_locale', 'it_IT'); require_once APPS_DIR . 'plugins/jpgraph/jpgraph.php'; require_once APPS_DIR . 'plugins/jpgraph/jpgraph_gantt.php'; // // The data for the graphs // setlocale(LC_ALL, 'it_IT.utf8'); $dateLocale = new DateLocale(); // Use Swedish locale $dateLocale->Set('it_IT.utf8'); $data = array(array(0, ACTYPE_GROUP, "Tempo Totale", "2011-12-13", "2012-02-12"), array(1, ACTYPE_NORMAL, "Istruttoria Preliminare", "2011-12-13", "2011-12-30"), array(2, ACTYPE_NORMAL, "Istruttoria Tecnica", "2011-12-30", "2012-01-18"), array(3, ACTYPE_NORMAL, "Istruttoria Amministrativa", "2012-01-18", "2012-01-30"), array(4, ACTYPE_MILESTONE, "Rilascio Titolo", "2012-02-09", 'RILASCIO TITOLO')); // Create the basic graph $graph = new GanttGraph(); $graph->title->Set("Scadenze Pratica n° 0125/2012"); // Setup scale //$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK); $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY); // Add the specified activities $graph->CreateSimple($data); // .. and stroke the graph $graph->Stroke(); //phpinfo(); ?>