/** * Create a JpGraph accumulated barPlot chart * * @param Array $bplot Array of JpGraph barPlot objects * @param Chart $graph The output graph that will contains accumulated barPlots * * @return Void */ private function displayAccumulatedGraph($bplot, $graph) { $abplot = new AccBarPlot($bplot); $abplot->SetAbsWidth(10); $graph->Add($abplot); $graph->Stroke(); }
/** * * @param Integer $groupId * @param String $groupBy * @param Date $startDate * @param Date $endDate * @param Boolean $absolute Is y-axis relative to data set or absolute (starting from 0) */ function displayProjectTotalSizeGraph($groupId, $groupBy, $startDate, $endDate, $absolute = true) { $graph = new Chart(420, 340, "auto"); $graph->img->SetMargin(70, 50, 30, 70); $graph->SetScale("textlin"); $graph->title->Set("Total project size growth over the time"); $graph->yaxis->title->Set("Size"); $graph->yaxis->SetTitleMargin(60); $graph->yaxis->setLabelFormatCallback(array($this, 'sizeReadable')); if ($absolute) { $graph->yaxis->scale->SetAutoMin(0); } $data = $this->_dum->getWeeklyEvolutionProjectTotalSize($groupId, $groupBy, $startDate, $endDate); if (is_array($data) && count($data) > 1) { $dates = array(); $ydata = array(); foreach ($data as $xdate => $values) { $dates[] = $xdate; $ydata[] = (double) $values; } $lineplot = new LinePlot($ydata); $color = '#6BA132'; $lineplot->SetColor($color); $lineplot->SetFillColor($color . ':1.5'); $lineplot->value->SetFont($graph->getFont(), FS_NORMAL, 8); $lineplot->value->setFormatCallback(array($this, 'sizeReadable')); $graph->Add($lineplot); $graph->xaxis->title->Set("Weeks"); $graph->xaxis->SetTitleMargin(35); $graph->xaxis->SetTickLabels($dates); $graph->Stroke(); } else { $this->displayError($GLOBALS['Language']->getText('plugin_statistics', 'no_data_error')); } }