$graph->xaxis->SetPosAbsDelta(15); $graph->yaxis->SetPosAbsDelta(-15); $graph->xaxis->SetLabelAngle(50); // Legend $graph->legend->SetMarkAbsSize(5); $graph->legend->SetFont(FF_ARIAL, FS_NORMAL, 7); $graph->legend->Pos(0.02, 0.02, "right", "top"); // Create the bar pot $colors = array("#aa5500", "#55aa00", "#0055aa", "#aa0055", "#5500aa", "#00aa55", "#ff0000", "#00ff00", "#0000ff", "#ffff00", "#ff00ff", "#00ffff"); $listPlots = array(); foreach ($opbysalle as $key => $value) { $bplot = new BarPlot($value["sejour"]); $from = $colors[$key]; $to = "#EEEEEE"; $bplot->SetFillGradient($from, $to, GRAD_LEFT_REFLECTION); $bplot->SetColor("white"); $bplot->setLegend($value["nom"]); $bplot->value->SetFormat("%01.0f"); $bplot->value->SetColor($colors[$key]); $bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 8); //$bplot->value->show(); $listPlots[] = $bplot; } $gbplot = new AccBarPlot($listPlots); $gbplot->SetWidth(0.6); $gbplot->value->SetFormat("%01.0f"); $gbplot->value->show(); // Set color for the frame of each bar $graph->Add($gbplot); // Finally send the graph to the browser $graph->Stroke();
$data_b = array($total ? $b * 100.0 / $total : 100); $data_c = array($total ? $c * 100.0 / $total : 0); // Build graph $graph = new Graph(400, 30); $graph->SetScale('textlin', 0, 100); $graph->Set90AndMargin(1, 1, 1, 1); $graph->SetMarginColor('#22262a'); $graph->SetColor('#22262a'); $graph->SetFrame(true, '#FFFFFF', 0); $bpa = new BarPlot($data_a); $bpa->SetFillColor('#CC0000'); $bpt = new BarPlot($data_b); if ($total == 0) { $bpt->SetFillColor('#222222'); } else { $bpt->SetFillColor('#888888'); } $bph = new BarPlot($data_c); $bph->SetFillColor('#0055FF'); $accplot = new AccBarPlot(array($bpa, $bpt, $bph)); $accplot->SetWidth(16); $graph->xaxis->Hide(); $graph->yaxis->HideLine(); $graph->yaxis->HideTicks(); $graph->yaxis->SetMajTickPositions(array(25, 50, 75)); $graph->ygrid->SetColor('#555555'); // Stroke $graph->Add($accplot); $graph->Stroke(); break; }
for ($i = 0; $i < count($datavalue); $i++) { $data = $datavalue[$i]; $target = $target_val[$i]; $graph_data = explode(",", $data); $data[$i] = $data; $bplot[$i] = new BarPlot($graph_data); $bplot[$i]->SetFillColor($color_array[$i]); $bplot[$i]->SetWidth(10); $bplot[$i]->value->Show(); $bplot[$i]->value->SetFont(FF_FONT1, FS_NORMAL, 8); $bplot[$i]->value->SetColor("black"); $bplot[$i]->value->SetFormat('%d'); $bplot[$i]->SetValuePos('max'); } $gbplot = new AccBarPlot($bplot); $gbplot->SetWidth(0.7); // Add the bar to the graph $graph->Add($gbplot); $graph->xaxis->SetTickLabels($datax); $graph->title->Set($title); $graph->Set90AndMargin($left, $right, $top, $bottom); //$graph->SetFrame(false); $graph->title->SetFont(FF_FONT1, FS_BOLD); $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD); $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD); $graph->SetColor("#7D9CB8"); $graph->SetMarginColor("#3D6A93"); // Display the graph $graph->Stroke(); ?>
/** * Execute the action * * @return mixed * @access public * @since 2/28/08 */ public function execute() { // New graph with a drop shadow $graph = new Graph(800, 600, 'auto'); $graph->SetShadow(); // Use a "text" X-scale $graph->SetScale("textlin"); // Specify X-labels //$databarx = array('tXi','','','xxx','','','iXii','','','OOO','','','tOO'); $graph->xaxis->SetFont(FF_VERA, FS_NORMAL); $graph->xaxis->SetTickLabels($this->getLabels()); $graph->xaxis->SetLabelAngle(45); $days = $this->getNumDays(); // Between 3 and 20 weeks, use weekly intervals if ($days > 21 && $days < 140) { $graph->xaxis->SetTextLabelInterval(7); } else { if ($days >= 140) { $graph->xaxis->SetTextLabelInterval(round($days / 20)); } } $graph->SetMargin(40, 20, 40, 80); // Set title and subtitle $title = _("Segue Usage for the past %1 %2"); $title = str_replace('%1', $this->getIntervalSize(), $title); if ($this->getIntervalSize() == 1) { $unit = $this->getIntervalUnit(); } else { $unit = $this->getIntervalUnit() . 's'; } $title = str_replace('%2', ucfirst(strtolower($unit)), $title); $graph->title->Set($title); // Use built in font $graph->title->SetFont(FF_VERA, FS_BOLD); $graph->legend->SetFont(FF_VERA, FS_NORMAL); // Create the bar plot $b1 = new BarPlot($this->getEdits()); $b1->SetLegend(_("Edits")); $b1->SetFillColor('#7778F3'); $b2 = new BarPlot($this->getFiles()); $b2->SetLegend(_("Files")); $b2->SetFillColor('#FFCB3F'); $b3 = new BarPlot($this->getComments()); $b3->SetLegend(_("Discussion Posts")); $b3->SetFillColor('#89DF6D'); $accbar = new AccBarPlot(array($b1, $b2, $b3)); $accbar->SetWidth(1); //$b1->SetShadow(); $graph->Add($accbar); $line = new LinePlot($this->getErrors()); $line->SetLegend(_("Errors")); $line->SetColor('#FF0000'); $line->SetWeight(1); $line->SetBarCenter(true); $graph->Add($line); $line = new LinePlot($this->getLogins()); $line->SetLegend(_("Logins")); $line->SetColor('#615FFF'); $line->SetWeight(1); $line->SetBarCenter(true); $graph->Add($line); $line = new LinePlot($this->getUsers()); $line->SetLegend(_("Distinct Users")); $line->SetColor('#0300FF'); $line->SetWeight(3); $line->SetBarCenter(true); // For months and less, display value for the number of users if ($days < 32) { $line->value->Show(); $line->value->HideZero(); $line->value->SetFormat("%d"); } $graph->Add($line); // Finally output the image $graph->Stroke(); exit; }