$lplot26->SetColor('salmon'); $graph->Add($lplot26); $lplot13 = new LinePlot($median13); $lplot13->SetColor('seagreen'); $graph->Add($lplot13); } if ($type == 7 || $type == 8) { $lplot13 = new LinePlot($median13); $lplot13->SetColor('seagreen'); $graph->Add($lplot13); $lplot = new LinePlot($median5); $lplot->SetColor('salmon'); $graph->Add($lplot); } $p1 = new StockPlot($datay); $p1->SetColor('blue', 'blue', 'red', 'red'); if ($type == 1) { $p1->SetWidth(50); } elseif ($type == 2) { $p1->SetWidth(8); } elseif ($type == 3 || $type == 5) { $p1->SetWidth(4); } else { $p1->SetWidth(2); } $p1->HideEndLines(); $p1->SetCenter(); $graph->Add($p1); $graph->xaxis->HideLabels(); $graph->xaxis->HideTicks(true, true); //$graph->yaxis->SetPosAbsDelta(430) ;//430 = 500-30-40
public function createGraph2($params = array(), $params2 = array()) { $em = $this->getDoctrine()->getManager(); list($param1, $param2, $param3, $y_eixo, $k, $nome, $tipo) = $params; list($ydata3, $ydata4, $dia_fim, $dia_ini, $code, $circuit) = $params2; $fields = $em->createQuery("SELECT d._719MediaOut, d._719MediaIn, d._719PeakOut, d._719PeakIn, \n\t\t\t \t\td.cirInRec, d.cirOutRec, d.day FROM CocarBundle:DailyPerformance d \n\t\t\t \t\tWHERE (d.day >= :start \n\t\t\t \t\t\tAND d.day <= :end)\n \t\t\t\t\t\t\t\tAND d.codeInterface = :code")->setParameter('start', $dia_ini)->setParameter('end', $dia_fim)->setParameter('code', $code)->getResult(); $i = 0; foreach ($fields as $f) { $p1 = $param1 == 'cir_out_rec' ? $f['cirOutRec'] : $f['cirInRec']; $p2 = $param2 == '7_19_media_out' ? $f['_719MediaOut'] : $f['_719MediaIn']; $p3 = $param3 == '7_19_pico_out' ? $f['_719PeakOut'] : $f['_719PeakIn']; $ydata = $param1 == 'cir_out_rec' ? $ydata4[$i] : $ydata3[$i]; $datay[] = $ydata / 20 + $p1 / $k; $datay[] = $p1 / $k; $datay[] = $p2 / $k; $datay[] = $p3 / $k; $a[] = $f['day']->format('d/m'); $i++; } // Create the graph. These two calls are always required $graph = new \Graph(580, 280, "auto"); $graph->SetScale("textlin"); $graph->img->SetMargin(60, 10, 5, 60); // Create the bar plots $b1plot = new \StockPlot($datay); $b1plot->SetWidth(9); $graph->title->Set("{$tipo}"); $graph->yaxis->title->Set($y_eixo); $graph->title->SetFont(FF_FONT1, FS_BOLD); $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD); $graph->xaxis->SetTickLabels($a); $graph->xaxis->SetLabelAngle(90); //acrescenta linhas de cir $lineplot3 = new \LinePlot($ydata3); $lineplot4 = new \LinePlot($ydata4); $lineplot3->SetColor("red"); $lineplot3->SetWeight(1); $lineplot4->SetColor("red"); $lineplot4->SetWeight(1); if ($tipo == "ENTRADA APS (últimos 30 dias) - Média/Taxa95%/Máx") { $graph->Add($lineplot4); } else { $graph->Add($lineplot3); } $b1plot->SetWeight(2); $b1plot->SetColor('blue', 'blue', 'orange', 'red'); // ...and add it to the graPH $graph->Add($b1plot); //Display the graph $graph->SetFrame(false); $nome_graf = $this->dir . "graficos/daily/" . $code . "_" . $nome . ".png"; $graph->Stroke($nome_graf); }