PHP Class Graph, GotCms Code Examples

This page contains top rated real world PHP examples of class Graph from package GotCms extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: graphics.php Project: jvasquez8704/sistema-administracion-contratos
0
 public function build()
 {
     $path = APPPATH;
     require_once $path . 'libraries/jpgraph/src/jpgraph.php';
     require_once $path . 'libraries/jpgraph/src/jpgraph_bar.php';
     //        $datay = array(62, 105, 85, 50);
     $datay = $this->parameters;
     // Create the graph. These two calls are always required
     //        $graph = new Graph(350, 220, 'auto');
     $graph = new Graph(350, 220, 'auto');
     $graph->SetScale("textlin");
     //$theme_class="DefaultTheme";
     //$graph->SetTheme(new $theme_class());
     // set major and minor tick positions manually
     $graph->yaxis->SetTickPositions(array(0, 30, 60, 90, 120, 150), array(15, 45, 75, 105, 135));
     $graph->SetBox(false);
     //$graph->ygrid->SetColor('gray');
     $graph->ygrid->SetFill(false);
     $graph->xaxis->SetTickLabels(array('A', 'B', 'C', 'D'));
     $graph->yaxis->HideLine(false);
     $graph->yaxis->HideTicks(false, false);
     // Create the bar plots
     //        $b1plot = new BarPlot($datay);
     $b1plot = new BarPlot($datay);
     // ...and add it to the graPH
     $graph->Add($b1plot);
     $b1plot->SetColor("white");
     $b1plot->SetFillGradient("#4B0082", "white", GRAD_LEFT_REFLECTION);
     $b1plot->SetWidth(45);
     $graph->title->Set("Bar Gradient(Left reflection)");
     // Display the graph
     $d['grafica'] = $graph->Stroke("jacobo.png");
     $d['path'] = $path;
     return $d;
 }
Example #2
Show file File: Alg.php Project: pscheit/psc-cms
0
 /**
  * Der Graph muss aus DependencyVertices bestehen
  *
  * die besonderen Knoten brauchen wir, da wir "hasOutgoingEdges()" nicht ganz easy berechnen können
  * (wir bräuchten die EdgesList flipped)
  *
  * Cormen, Thomas H.; Leiserson, Charles E.; Rivest, Ronald L.; Stein, Clifford (2001), "Section 22.4: Topological sort", Introduction to Algorithms (2nd ed.), MIT Press and McGraw-Hill, pp. 549–552, ISBN 0-262-03293-7.
  * 
  * gibt eine Liste aller Vertices in der topologischen Sortierung zurück
  * die elemente mit "den meisten dependencies" befinden sich hinten in der liste
  * @return array 
  */
 public static function TopologicalSort(Graph $g)
 {
     $list = array();
     if (count($g->V()) == 0) {
         return $list;
     }
     // rufe DFS auf $g auf
     // füge jeden abgearbeiteten Knoten an den Kopf einer Liste ein
     $dfsVisit = function (DependencyVertice $vertice) use($g, &$list, &$dfsVisit) {
         if (!$vertice->isVisited()) {
             $vertice->setVisited(TRUE);
             foreach ($g->N($vertice) as $adjacentVertice) {
                 $dfsVisit($adjacentVertice);
             }
             array_unshift($list, $vertice);
         }
     };
     // wir beginnen nicht mit einem Startknoten sondern mit allen Startknoten, die keine dependencies haben
     $s = array();
     foreach ($g->V() as $vertice) {
         if (count($vertice->getDependencies()) === 0) {
             $s[] = $vertice;
             $dfsVisit($vertice);
         }
     }
     if (count($s) === 0) {
         throw new TopologicalSortRuntimeException('Der Graph g kann nicht topologisch sortiert werden. Es wurden keine Startknoten gefunden die überhaupt keine Dependencies haben');
     }
     return $list;
 }
Example #3
Show file File: actions.class.php Project: lendji4000/compose
0
 public function executeGetFunctionGraph(sfWebRequest $request)
 {
     $this->getUrlParameters($request);
     $this->fct_id = $request->getParameter('function_id');
     $this->fct_ref = $request->getParameter('function_ref');
     //récupération du nom pour les affichages.
     $this->node = Doctrine_Core::getTable('EiTree')->findOneByRefObjAndObjIdAndType($this->fct_ref, $this->fct_id, 'Function');
     //récupération des temps d'execution
     $this->times = Doctrine_Core::getTable('EiFonction')->getTimeStats($this->project_id, $this->project_ref, $this->fct_id, $this->fct_ref);
     // Width and height of the graph
     $width = 700;
     $height = 300;
     // Create a graph instance
     $graph = new Graph($width, $height);
     $graph->SetScale('intint');
     $graph->title->Set($this->node->getName() . " 's execution time evolution.");
     $graph->xaxis->title->Set('Execution');
     $graph->yaxis->title->Set('Time (ms)');
     $exec = array();
     //récupération des durées uniquement
     foreach ($this->times as $t => $time) {
         $exec[] = $time['l_duree'];
     }
     $lineplot = new LinePlot($exec);
     $graph->Add($lineplot);
     $graph->Stroke();
     return sfView::NONE;
 }
Example #4
Show file File: ci_comparacion_unidad.php Project: pkogan/presupuesto
0
 function conf__grafico(toba_ei_grafico $grafico)
 {
     if (isset($this->datos)) {
         $datos = array();
         $leyendas = array();
         foreach ($this->datos as $value) {
             $datos[] = $value['resultado'];
             $leyendas[] = $value['codc_uacad'];
         }
     }
     require_once toba_dir() . '/php/3ros/jpgraph/jpgraph.php';
     require_once toba_dir() . '/php/3ros/jpgraph/jpgraph_bar.php';
     // Setup a basic graph context with some generous margins to be able
     // to fit the legend
     $canvas = new Graph(900, 300);
     $canvas->SetMargin(100, 140, 60, 40);
     $canvas->title->Set('Cr�dito Disponible');
     //$canvas->title->SetFont(FF_ARIAL,FS_BOLD,14);
     // For contour plots it is custom to use a box style ofr the axis
     $canvas->legend->SetPos(0.05, 0.5, 'right', 'center');
     $canvas->SetScale('intint');
     //$canvas->SetAxisStyle(AXSTYLE_BOXOUT);
     //$canvas->xgrid->Show();
     $canvas->ygrid->Show();
     $canvas->xaxis->SetTickLabels($leyendas);
     // A simple contour plot with default arguments (e.g. 10 isobar lines)
     $cp = new BarPlot($datos);
     $cp->SetColor("#B0C4DE");
     $cp->SetFillColor("#B0C4DE");
     $cp->SetLegend("Resultado");
     $canvas->Add($cp);
     // Con esta llamada informamos al gr�fico cu�l es el gr�fico que se tiene
     // que dibujar
     $grafico->conf()->canvas__set($canvas);
 }
Example #5
Show file File: GraphVisitsMonthAllYears.php Project: Ethennoob/Web
0
 function plot($pid)
 {
     $this->_setValues($pid);
     $graph = new Graph(600, 400);
     $graph->img->SetMargin(60, 95, 40, 40);
     $graph->SetShadow();
     $graph->SetScale("textlog");
     $colors = array("hotpink", "green", "blue", "gold", "blueviolet", "deepskyblue", "brown", "cadetblue", "darksalmon", "cornflowerblue", "darkslateblue", "limegreen", "yellow", "navy", "slategray");
     srand(1);
     for ($i = 0; $i < sizeof($this->_data); $i++) {
         $bplot[$i] = new BarPlot($this->_data[$i]);
         if ($i < sizeof($colors)) {
             $color = $colors[$i];
         } else {
             $r = rand(0, 255);
             $g = rand(0, 255);
             $b = rand(0, 255);
             $color = array($r, $g, $b);
         }
         $bplot[$i]->SetFillColor($color);
         $bplot[$i]->SetLegend($this->_legend[$i]);
     }
     $gbplot = new GroupBarPlot($bplot);
     $graph->Add($gbplot);
     $graph->title->Set("# of Visited Articles per Month (log scale)");
     $graph->title->SetFont(FONT2_BOLD);
     $graph->xaxis->SetTickLabels($this->_months);
     $graph->ygrid->Show(true, true);
     $graph->xaxis->SetFont(FONT1_BOLD);
     $graph->yaxis->SetFont(FONT1_BOLD);
     $graph->Stroke();
 }
Example #6
Show file File: torta3D.php Project: emacer/Gereho
0
function graficarBarras()
{
    require_once "jpgraph/src/jpgraph.php";
    require_once "jpgraph/src/jpgraph_bar.php";
    $datos = array($_GET['pos'], $_GET['neg']);
    //Instancia del objeto del tipo Graph en donde como parametro
    // se le pasan los valore de ancho y altura
    $grafica = new Graph(400, 300);
    $grafica->SetScale("textlin");
    $grafica->SetBox(false);
    //Nombre de las columnas
    $columnas = array($_GET['lab1'], $_GET['lab2']);
    $grafica->xaxis->SetTickLabels($columnas);
    //Objeto del tipo BarPlot que se le enviara a la grafica y el cual
    //recibe como parametros los datos a graficar
    $barras = new BarPlot($datos);
    $grafica->Add($barras);
    //Color de los bordes
    //Color de borde de las barras
    $barras->SetColor("white");
    //Color de relleno de las barras
    $barras->SetFillColor("#4B0082");
    //Ancho de las barras
    $barras->SetWidth(45);
    // $grafica->title->Set("Gráfica de Barras");
    $grafica->title->SetFont(FF_TIMES, FS_ITALIC, 18);
    $grafica->Stroke();
}
Example #7
Show file File: word_ladder.php Project: jonnung/word_ladder_graph
0
/**
 * 단어 목록으로 인접 리스트를 사용해서 그래프 생성
 *
 * @param string $word_file 단어파일
 * @return object Graph 그래프객체
 * @throws Exception
 */
function buildWordLadderGraph($word_file)
{
    $container = array();
    $graph = new Graph();
    $f = fopen($word_file, "r");
    if ($f) {
        while (($word = fgets($f)) !== false) {
            $container = setBucketContainer($container, trim($word));
        }
        fclose($f);
    } else {
        throw new Exception('파일을 읽을 수 없습니다.');
    }
    $bucket_keys = array_keys($container);
    foreach ($bucket_keys as $bucket) {
        foreach ($container[$bucket] as $word1) {
            foreach ($container[$bucket] as $word2) {
                if ($word1 != $word2) {
                    $graph->addEdge($word1, $word2);
                }
            }
        }
    }
    return $graph;
}
Example #8
Show file File: GraficarController.php Project: EdgardoPitti/plagetri21v2
0
 public function getGrafmayorcosto()
 {
     JpGraph::module('bar');
     $graph = new Graph(680, 300);
     $graph->SetScale("textlin");
     $graph->yscale->SetGrace(5);
     $graph->SetBox(true);
     $labels = array();
     $valores = array();
     foreach (Activo::where('id', '>', '0')->orderBy('costo', 'desc')->take(10)->get() as $activo) {
         $labels[] = $activo->num_activo;
         $valores[] = $activo->costo;
     }
     //titulo de la grafica
     $graph->title->SetColor('black');
     $graph->title->Set('Gráfica: Activos con Mayor Costo');
     //valores de los labels en ambas axis y como se ubicaran
     $graph->xaxis->SetTickLabels($labels);
     $graph->xaxis->SetLabelAlign('center', 'top', 'center');
     $graph->ygrid->SetFill(false);
     $graph->yaxis->HideLabels(false);
     $graph->yaxis->HideTicks(false, false);
     //Fonts para las axis
     $graph->xaxis->SetColor('black');
     $graph->yaxis->SetColor('black');
     //grafica de activos con mayor costo
     $mayorCosto = new BarPlot($valores);
     $mayorCosto->SetColor('white');
     $mayorCosto->SetWidth(0.6);
     //agrega la grafica generada a la instancia de la grafica
     $graph->Add($mayorCosto);
     //Despliega la grafica
     $graph->Stroke();
 }
Example #9
Show file File: showimg.php Project: youli023023/zabbix_api
0
function showimg($value, $clock, $key)
{
    $datay1 = $value;
    $graph = new Graph(1000, 400);
    $graph->SetScale("textlin");
    //设置图片外边距(左,右,上,下)
    $graph->img->SetMargin(100, 20, 20, 60);
    $graph->title->Set($key);
    $graph->yaxis->HideZeroLabel();
    $graph->yaxis->HideLine(false);
    $graph->yaxis->HideTicks(false, false);
    $graph->xgrid->Show();
    $graph->xgrid->SetLineStyle("solid");
    //x轴文字
    $graph->xaxis->SetTickLabels($clock);
    $graph->xaxis->SetLabelAngle(90);
    //x轴颜色
    $graph->xgrid->SetColor('#E3E3E3');
    // Create the first line
    $p1 = new LinePlot($datay1);
    $graph->Add($p1);
    $p1->SetColor("#6495ED");
    $graph->legend->SetFrameWeight(1);
    // Output line
    $graph->Stroke();
}
Example #10
Show file File: jpgraph.php Project: FaddliLWibowo/MapIgniter
0
 function monthchart($xdata, $ydata, $title = 'Line Chart')
 {
     // Create the graph. These two calls are always required
     $graph = new Graph(600, 250, "auto", 60);
     $graph->img->SetAntiAliasing(false);
     $graph->SetScale("textlin");
     $graph->xaxis->SetTickLabels($xdata);
     $graph->xgrid->SetColor('#E3E3E3');
     $graph->legend->SetFrameWeight(1);
     // Setup title
     $graph->title->Set($title);
     foreach ($ydata as $item) {
         // Create the linear plot
         if (count($item['values']) != count($xdata)) {
             continue;
         }
         $lineplot = new LinePlot($item['values'], $xdata);
         $lineplot->SetColor($item['color']);
         if (count($ydata) == 1) {
             $lineplot->SetFillColor($item['color']);
         }
         // Add the plot to the graph
         $graph->Add($lineplot);
         $lineplot->SetLegend($item['legend']);
     }
     return $graph;
 }
Example #11
Show file File: GraphLanguageYear.php Project: Ethennoob/Web
0
 function plot($pid)
 {
     $this->_setValues($pid);
     $graph = new Graph(600, 400);
     $graph->img->SetMargin(60, 95, 40, 40);
     $graph->SetShadow();
     $graph->SetScale("textlog");
     $colors = array("yellow", "green", "blue", "red");
     srand(1);
     for ($i = 0; $i < sizeof($this->_data); $i++) {
         $bplot[$i] = new BarPlot($this->_data[$i]);
         $color = $colors[$i];
         $bplot[$i]->SetFillColor($color);
         $bplot[$i]->SetLegend($this->_legend[$i]);
     }
     $gbplot = new GroupBarPlot($bplot);
     $graph->Add($gbplot);
     $graph->title->Set("# of Visited Articles per Language (log scale)");
     $graph->title->SetFont(FONT2_BOLD);
     $graph->xaxis->SetTickLabels($this->_years);
     $graph->ygrid->Show(true, true);
     $graph->xaxis->SetFont(FONT1_BOLD);
     $graph->yaxis->SetFont(FONT1_BOLD);
     $graph->Stroke();
 }
Example #12
Show file File: classgrafico.php Project: jaironman3008/mercadomundial
0
 public function graficofecha($gestion)
 {
     if (Conectar::con()) {
         //$gestion='2013';
         $objetoanalisis = new classAnalisis();
         $anio = $gestion;
         for ($i = 0; $i < 12; $i++) {
             $dat[] = $objetoanalisis->ventamensual($anio, $i);
         }
         $datos = $dat;
         //$datos =array('1','4','3','3','5');
         $grafico = new Graph(400, 300, "auto");
         $grafico->SetScale("textlin");
         $grafico->title->Set("Resumen de ventas por gestion");
         $grafico->xaxis->title->Set("");
         $grafico->yaxis->title->Set("");
         // Un gradiente Horizontal de rojo a azul
         // 25 pixeles de ancho para cada barra
         $lineplot = new LinePlot($datos);
         $lineplot->SetColor("green");
         $lineplot->SetWeight(2);
         $grafico->Add($lineplot);
         return $grafico->Stroke();
     }
 }
Example #13
Show file File: graphs.php Project: neymanna/fusionforge
0
/**
 * Show Horizontal Bar graph
 */
function ShowHBar(&$legend, &$value)
{
    $height = 50 + count($value) * 18;
    $width = 500;
    // Set the basic parameters of the graph
    $graph = new Graph($width, $height, 'auto');
    $graph->SetScale("textlin");
    $top = 30;
    $bottom = 20;
    $left = 100;
    $right = 50;
    $graph->Set90AndMargin($left, $right, $top, $bottom);
    $graph->xaxis->SetTickLabels($legend);
    $graph->SetFrame(false);
    // Label align for X-axis
    $graph->xaxis->SetLabelAlign('right', 'center', 'right');
    // Label align for Y-axis
    $graph->yaxis->SetLabelAlign('center', 'bottom');
    // Create a bar pot
    $bplot = new BarPlot($value);
    $bplot->SetFillColor("orange");
    $bplot->SetWidth(0.5);
    // We want to display the value of each bar at the top
    $graph->yaxis->scale->SetGrace(10);
    $graph->yaxis->SetLabelAlign('center', 'bottom');
    $graph->yaxis->SetLabelFormat('%d');
    $bplot->value->Show();
    $bplot->value->SetFormat('%.d votes');
    // Setup color for gradient fill style
    $bplot->SetFillGradient("navy", "lightsteelblue", GRAD_MIDVER);
    $graph->Add($bplot);
    $graph->Stroke();
}
Example #14
Show file File: preview.php Project: drognisep/Simple-Groupware
0
function _stats_build_graph($data, $labels, $filename, $stat, $width, $height, $vars)
{
    if (file_exists($filename)) {
        unlink($filename);
    }
    $data_orig = $data;
    foreach ($data as $key => $val) {
        if (!is_numeric($val)) {
            $data[$key] = 0;
        }
    }
    // $vars["color_tab_black"]
    $bg_grey = _stats_color($vars["bg_grey"], 0);
    $bg_light_blue = _stats_color($vars["bg_light_blue"], 25);
    $graph = new Graph($width, $height);
    $group = new PlotGroup();
    $group->setSpace(2, 2);
    $group->grid->setType(LINE_DASHED);
    $group->grid->hideVertical(TRUE);
    $group->setPadding(30, 10, 25, 20);
    $graph->setBackgroundColor($bg_grey);
    $graph->title->set($stat);
    $graph->title->setFont(new Tuffy(10));
    $plot = new BarPlot($data, 1, 1, 0);
    $plot->setBarColor($bg_light_blue);
    $plot->label->set($data_orig);
    $plot->label->move(0, -5);
    $group->add($plot);
    $group->axis->bottom->setLabelText($labels);
    $group->axis->bottom->hideTicks(TRUE);
    $graph->add($group);
    $graph->draw($filename);
}
Example #15
Show file File: analisis.php Project: codethics/proteoerp
0
 function departa()
 {
     $this->load->library('Graph');
     $data = $titu = array();
     $mes = $this->uri->segment(4);
     $anio = $this->uri->segment(5);
     if (empty($mes) and empty($anio)) {
         return;
     }
     $fechai = $anio . $mes . '01';
     $fechaf = $anio . $mes . '31';
     //8471.49.00.00
     $mSQL = "SELECT f.descrip etiqueta, sum(b.importe) total\n\t\t\tFROM itscst b JOIN scst a ON a.control=b.control \n\t\t\tJOIN sinv c ON b.codigo=c.codigo\n\t\t\tJOIN grup d ON d.grupo=c.grupo\n\t\t\tJOIN line e ON d.linea=e.linea \n\t\t\tJOIN dpto f ON e.depto=f.depto \n\t\t\tWHERE a.tipo_doc IN ('FC', 'NC','NE') AND a.fecha>={$fechai} AND a.fecha<={$fechaf}\n\t\t\tGROUP BY f.depto";
     //echo $mSQL;
     $maxval = 0;
     $query = $this->db->query($mSQL);
     foreach ($query->result() as $row) {
         if ($row->total > $maxval) {
             $maxval = $row->total;
         }
         $data[] = $row->total;
         $titu[] = $row->etiqueta;
     }
     $i = 1;
     while (1) {
         if ($maxval / $i <= 100) {
             break;
         }
         $i = $i * 10;
     }
     $om = $i;
     $i = 0;
     //$om=1;
     for ($i = 0; $i < count($data); $i++) {
         $data[$i] = $data[$i] / $om;
     }
     $g = new Graph();
     if ($maxval > 0) {
         $g->title('COMPRAS DEL ' . $mes . '/' . $anio, '{font-size:18px; color: #d01f3c}');
         $g->set_data($data);
         $g->bar_glass(55, '#5E83BF', '#424581', 'Compras', 10);
         $g->set_y_max(ceil($maxval / $om));
         $g->y_label_steps(5);
         $g->set_x_labels($titu);
         $ejey = number_format($om, 0, '', ' ');
         $g->set_y_legend('Compras X ' . $ejey . ' (Bs)', 14, '0x639F45');
         $g->set_x_legend('Grupos ' . $mes, 14, '0x639F45');
         //$g->pie(60,'#505050','#000000');
         //$g->pie_values( $data, $titu );
         //$g->pie_slice_colours( array('#d01f3c','#356aa0','#C79810','#5E83BF'));
         $g->set_tool_tip('#key#<br>Departamento: #x_label# <br>Monto: #val# x ' . $ejey);
     } else {
         $g->title('NO EXISTEN VENTAS EN LA FECHA SELECCIONADA', '{font-size:18px; color: #d01f3c}');
     }
     $g->bg_colour = '#FFFFFF';
     //$g->set_bg_image(site_url('/images/ventafon.png'), 'center', 'middle' );
     echo $g->render();
     $query->free_result();
 }
Example #16
Show file File: toba_ei_grafico_conf.php Project: emma5021/toba
0
 /**
  * Genera la imagen
  * @param string $path path completo de la imagen a generar
  */
 function imagen__generar($path)
 {
     if (!isset($this->canvas)) {
         throw new toba_error("Generación de imágen: No hay ningún canvas seteado");
     }
     // escribimos la imagen a un archivo
     $this->canvas->Stroke($path);
 }
Example #17
Show file File: AlternativesAnalyze.class.php Project: sensorsix/app
0
 /**
  * @return Graph|Doctrine_Record
  */
 protected function saveGraph()
 {
     $graph = new Graph();
     $graph->decision_id = $this->decision_id;
     $graph->graph_type_id = $this->graph_type_id;
     $graph->save();
     return $graph;
 }
Example #18
Show file File: Cron.class.php Project: Albertoni/GFUserDatabase
0
 private function _generateBestFetchersGraph()
 {
     $graph = new Graph();
     $graph->setMargin(100);
     $query = "\n\t\t\tSELECT\n\t\t\t\tname label,\n\t\t\t\tnum_added value\n\t\t\tFROM\n\t\t\t\tlogins\n\t\t\tORDER BY\n\t\t\t\tvalue DESC\n\t\t\tLIMIT 50\n\t\t\t";
     $data = $this->_db->execute($query)->getArray();
     $graph->setData($data);
     $graph->saveTo('r/d/best-fetchers.png');
 }
Example #19
Show file File: grapher.php Project: alexismansilla/codeigniter-jpgraph
0
 public function index()
 {
     // We want a bar graph, so use JpGraph's bar chart library
     require_once APPPATH . '/libraries/JpGraph/jpgraph_bar.php';
     // Example data (04/2015)
     $json = '[{"Hogwarts Academy":{"Yield":"19021 kWh","Yield specific":"127.01 kWh\\/kWp","Target yield":"16069.23 kWh","Current-target yield %":"<span style=\\"color: #3ab121\\">118.37 %<span>"}},{"cols": [{"id":"","label":"Time","pattern":"","type":"string"},{"id":"","label":"Hogwarts Academy (AC)","pattern":"","type":"number"},{"id":"","label":"Target values","pattern":"","type":"number"}], "rows": [{"c":[{"v":"01/04","f":null}, {"v":615.8,"f":"615,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"02/04","f":null}, {"v":712.5,"f":"712,50 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"03/04","f":null}, {"v":171,"f":"171,00 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"04/04","f":null}, {"v":382.3,"f":"382,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"05/04","f":null}, {"v":606.3,"f":"606,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"06/04","f":null}, {"v":774.5,"f":"774,50 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"07/04","f":null}, {"v":570.6,"f":"570,60 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"08/04","f":null}, {"v":726.8,"f":"726,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"09/04","f":null}, {"v":789.2,"f":"789,20 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"10/04","f":null}, {"v":592.9,"f":"592,90 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"11/04","f":null}, {"v":677.1,"f":"677,10 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"12/04","f":null}, {"v":244.5,"f":"244,50 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"13/04","f":null}, {"v":457.4,"f":"457,40 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"14/04","f":null}, {"v":340.8,"f":"340,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"15/04","f":null}, {"v":425.3,"f":"425,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"16/04","f":null}, {"v":828.8,"f":"828,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"17/04","f":null}, {"v":616.8,"f":"616,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"18/04","f":null}, {"v":660.3,"f":"660,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"19/04","f":null}, {"v":453.2,"f":"453,20 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"20/04","f":null}, {"v":691.9,"f":"691,90 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"21/04","f":null}, {"v":904.4,"f":"904,40 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"22/04","f":null}, {"v":879.1,"f":"879,10 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"23/04","f":null}, {"v":824.8,"f":"824,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"24/04","f":null}, {"v":777.9,"f":"777,90 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"25/04","f":null}, {"v":413.8,"f":"413,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"26/04","f":null}, {"v":834.8,"f":"834,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"27/04","f":null}, {"v":920.8,"f":"920,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"28/04","f":null}, {"v":751,"f":"751,00 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"29/04","f":null}, {"v":737.7,"f":"737,70 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"30/04","f":null}, {"v":638.7,"f":"638,70 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]}]}]';
     // Turn string into object
     $obj = json_decode($json);
     // Stores for graph data
     $xdata = array();
     $ydata = array();
     // Get coords data from object
     $obj_data = $obj[1]->rows;
     $counter = 1;
     // Add it to each of our storage arrays
     foreach ($obj_data as $data) {
         // only plot when there is a kW value
         if (isset($data->c[1]->v)) {
             $xdata[] = $data->c[0]->v;
             // date
             $ydata[] = $data->c[1]->v;
             // kw
         }
     }
     // Create the graph.
     // One minute timeout for the cached image
     // INLINE_NO means don't stream it back to the browser.
     $graph = new Graph(600, 350, 'auto');
     $graph->SetScale("textlin");
     $graph->img->SetMargin(60, 30, 20, 40);
     $graph->yaxis->SetTitleMargin(45);
     $graph->yaxis->scale->SetGrace(30);
     $graph->SetShadow();
     // Turn the tickmarks
     $graph->xaxis->SetTickSide(SIDE_DOWN);
     $graph->yaxis->SetTickSide(SIDE_LEFT);
     // Create a bar pot
     $bplot = new BarPlot($ydata);
     $bplot->SetFillColor("orange");
     // Use a shadow on the bar graphs (just use the default settings)
     $bplot->SetShadow();
     $bplot->value->SetFormat(" %2.1f kW", 70);
     $bplot->value->SetFont(FF_VERDANA, FS_NORMAL, 8);
     $bplot->value->SetColor("blue");
     $bplot->value->Show();
     $graph->Add($bplot);
     $graph->title->Set("Hogwarts Academy");
     $graph->xaxis->title->Set("Day");
     $graph->yaxis->title->Set("Yield in kilowatt hours");
     $graph->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
     // Send back the HTML page which will call this script again
     // to retrieve the image.
     $graph->StrokeCSIM();
 }
Example #20
Show file File: DepthFirstPaths.php Project: tiger-seo/algorithms
0
 private function dfs($v)
 {
     $this->marked[$v] = true;
     foreach ($this->graph->getAdjacentTo($v) as $w) {
         if (!$this->marked[$w]) {
             $this->dfs($w);
             $this->edgeTo[$w] = $v;
         }
     }
 }
Example #21
Show file File: DepthFirstSearch.php Project: YuraMalahov/algorithms
0
 /**
  * @param Graph $graph
  * @param int $vertex
  */
 private function depthSearch(Graph $graph, int $vertex)
 {
     $this->marked[$vertex] = true;
     $this->count++;
     foreach ($graph->adjacent($vertex) as $adjacent) {
         if ($this->isMarked($adjacent)) {
             continue;
         }
         $this->depthSearch($graph, $adjacent);
     }
 }
Example #22
Show file File: Factory.php Project: fredjti/graphlib-php
0
 public static function path($n)
 {
     $g = new Graph("Path " . $n);
     for ($i = 1; $i <= $n + 1; $i++) {
         $g->addVertexByID("v" . $i);
     }
     for ($i = 1; $i < $n + 1; $i++) {
         $g->addEdgeByID("v" . $i, "v" . ($i + 1));
     }
     return $g;
 }
Example #23
Show file File: GraphicsController.php Project: josimarjimenez/architects
0
 /**
  *
  */
 public function iterationSummary($id)
 {
     $iteration = Iterations::findOrFail($id);
     $issues = Issue::where('iterationid', '=', $iteration->id)->get();
     $tasksId = array();
     foreach ($issues as $issue) {
         $tasksId[] = $issue->id;
     }
     $tasks = Task::whereIn('issueid', $tasksId)->get();
     $countTODO = 0;
     $countDOING = 0;
     $countDONE = 0;
     foreach ($tasks as $task) {
         switch ($task->scrumid) {
             case 1:
                 $countTODO++;
                 break;
             case 2:
                 $countDOING++;
                 break;
             case 3:
                 $countDONE++;
                 break;
         }
     }
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('bar');
     $l1datay = array($countTODO, $countDOING, $countDONE);
     //$datax=array('TO-DO','DOING','DONE');
     $datax = array('POR HACER', 'HACIENDO', 'HECHAS');
     //Create the graph
     $graph = new Graph(700, 300);
     $graph->SetScale('textlin');
     $graph->img->SetMargin(60, 130, 40, 60);
     $graph->SetShadow();
     // Create the linear error plot
     $l1plot = new BarPlot($l1datay);
     $l1plot->SetColor('red');
     $l1plot->SetWeight(2);
     $l1plot->SetLegend('Avance de iteracion');
     // Add the plots to t'he graph
     $graph->Add($l1plot);
     $graph->xaxis->SetTickLabels($datax);
     $graph->title->Set('Tareas');
     //$graph->xaxis->title->Set('Estados');
     //$graph->yaxis->title->Set('Cantidad');
     $graph->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
     //Display the graph
     $graph->Stroke();
 }
Example #24
Show file File: GraphicsTaskController.php Project: josimarjimenez/architects
0
 public function bar_task($id)
 {
     $help = new Helper();
     $issues = $help->searchIssues($id);
     //foreach ($issues as $issue) {
     # code...
     //	$issue->id
     //}
     //$iteration = Iterations::findOrFail($id);
     //$idTmp = $iteration->id;
     // $issues = Issue::where('iterationid','=', $idTmp)->get();
     //$issues = $iteration->issues;
     //$countIssues = sizeof($issues);
     $countIssues = 0;
     $dataEstimatedTime = array();
     $dataRealTime = array();
     $dataIterationName = array();
     $countTODO = 0;
     $countDOING = 0;
     $countDONE = 0;
     //$string_iterations = implode(";", $iterations);
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('bar');
     JpGraph\JpGraph::module('line');
     $datay = array(12, 8, 19, 3, 10, 5);
     // Create the graph. These two calls are always required
     $graph = new Graph(300, 200);
     $graph->SetScale('textlin');
     // Add a drop shadow
     $graph->SetShadow();
     // Adjust the margin a bit to make more room for titles
     $graph->SetMargin(40, 30, 20, 40);
     // Create a bar pot
     $bplot = new BarPlot($datay);
     // Adjust fill color
     $bplot->SetFillColor('orange');
     $graph->Add($bplot);
     // Setup the titles
     $graph->title->Set('A basic bar graph ');
     $graph->xaxis->title->Set('X-title');
     $graph->yaxis->title->Set('Y-title');
     $graph->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
     //$graph->Stroke();
     //$response = Response::make(
     //     $graph->Stroke()
     //);
     //    	$response->header('content-type', 'image/png');
     //  	return $response;
 }
Example #25
Show file File: Algorithm.php Project: fredjti/graphlib-php
0
 /**
  * It verifies if the graph is or not regular.
  * 
  * @param g
  * @return true, if the graph is regular; or false, on the contrary.
  */
 public static function isRegular(Graph $g)
 {
     $allVertices = $g->getVertexSet();
     $degree = -1;
     foreach ($allVertices as $vertex) {
         if ($degree != -1) {
             if ($g->degreeOf($vertex) != $degree) {
                 return false;
             }
         } else {
             $degree = $g->degreeOf($vertex);
         }
     }
     return true;
 }
Example #26
Show file File: status.php Project: BackupTheBerlios/horux-svn
0
 protected function getImage_p($id)
 {
     require_once "./protected/pages/components/velopark/artichow/Pie.class.php";
     $sql = "SELECT id, area,filling, name FROM  hr_vp_parking ";
     $cmd = $this->db->createCommand($sql);
     $data = $cmd->query();
     $data = $data->read();
     $graph = new Graph(500, 300);
     $graph->setBackgroundGradient(new LinearGradient(new White(), new VeryLightGray(40), 0));
     $graph->title->set(Prado::localize("Service {name}", array("name" => utf8_decode($data['name']))));
     $graph->shadow->setSize(3);
     $graph->shadow->smooth(TRUE);
     $graph->shadow->setPosition(Shadow::RIGHT_BOTTOM);
     $graph->shadow->setColor(new DarkGray());
     $values = array($data['filling'], $data['area'] - $data['filling'] + 1.0E-9);
     //$values = array(22.0,0.000000001);
     $colors = array(new LightRed(), new LightGreen());
     $plot = new Pie($values, $colors);
     $plot->setCenter(0.42, 0.55);
     $plot->setSize(0.7, 0.7);
     $plot->set3D(20);
     /*if($data['filling']>0)
       $plot->explode(array(1 => 10));*/
     $plot->setLegend(array(utf8_decode(Prado::localize('Used')), utf8_decode(Prado::localize('Free'))));
     $plot->legend->setPosition(1.3);
     $plot->legend->shadow->setSize(0);
     $plot->legend->setBackgroundColor(new VeryLightGray(30));
     $graph->add($plot);
     $graph->draw();
     exit;
 }
Example #27
Show file File: util.lib.php Project: Sunnepah/ldphp
0
function LDP_get_prefix($path, $uri, $type = 'http://ns.rww.io/ldpx#ldprPrefix')
{
    if ($path && $uri) {
        $g = new Graph('', $path, '', $uri);
        if ($g->size() > 0) {
            // specific authorization
            $q = 'SELECT ?s, ?prefix WHERE { ?s <' . $type . '> ?prefix }';
            $s = $g->SELECT($q);
            $res = $s['results']['bindings'];
            if (isset($res) && count($res) > 0) {
                return $res[0]['prefix']['value'];
            }
        }
    }
    return null;
}
Example #28
Show file File: GenerarGrafico.php Project: samrodriguez/plusbella
0
 public function toPdf($titulo, $consulta, $encabezado)
 {
     //$data1y = array(4,8,6);
     $this->pdf->FPDF('P', 'mm', 'Letter');
     $this->pdf->SetTopMargin(20);
     $this->pdf->SetLeftMargin(20);
     $this->pdf->AddPage();
     $this->pdf->SetFillColor(255);
     $this->pdf->SetFont('Arial', 'B', 16);
     $this->pdf->Cell(180, 32, $titulo, 0, 0, 'C');
     $this->pdf->SetFont('Arial', 'B', 13);
     $this->pdf->Ln(26);
     $this->pdf->Ln(15);
     //$graph = new \Graph(270, 200, 'auto');
     // Se define el array de datos
     $datosy = array(25, 16, 24, 5, 8, 31);
     // Creamos el grafico
     $grafico = new \Graph(500, 250);
     $grafico->SetScale('textlin');
     // Ajustamos los margenes del grafico-----    (left,right,top,bottom)
     $grafico->SetMargin(40, 30, 30, 40);
     // Creamos barras de datos a partir del array de datos
     $bplot = new \BarPlot($datosy);
     // Configuramos color de las barras
     $bplot->SetFillColor('#479CC9');
     //Añadimos barra de datos al grafico
     $grafico->Add($bplot);
     // Queremos mostrar el valor numerico de la barra
     $bplot->value->Show();
     // Configuracion de los titulos
     $grafico->title->Set('Ingreso de paquetes');
     $grafico->xaxis->title->Set('Meses');
     $grafico->yaxis->title->Set('Ingresos ($)');
     $grafico->title->SetFont(FF_FONT1, FS_BOLD);
     $grafico->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $grafico->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $nombreGrafico = "Barras";
     @unlink("{$nombreGrafico}.png");
     // Se muestra el grafico
     $grafico->Stroke("{$nombreGrafico}.png");
     //img = $grafico->Stroke(_IMG_HANDLER);
     //Aqui agrego la imagen que acabo de crear con jpgraph
     $this->pdf->Image("{$nombreGrafico}.png", $this->pdf->GetX() + 20, $this->pdf->GetY(), 120, 90);
     //$this->pdf->GDImage($img,50,50,110,70);
     $this->pdf->Output();
     return $this->pdf;
 }
Example #29
Show file File: GraphTest.php Project: shoaibi/speed-typing
0
 public function testUnprogrammedKeyMissingEnabledUsingConstructor()
 {
     $graph = Graph::getInstance(true);
     $nodes = $graph->getNodes();
     $this->assertNotNull($nodes[ord('')]);
     $expected = array('Up' => '8', 'Right' => ' ', 'Down' => 'I', 'Left' => '>');
     $this->assertEquals($expected, $nodes[ord('')]);
 }
Example #30
Show file File: AbstractUndirectedGraph.php Project: jeanphilippe-p/ObjectManagerLib
0
 /**
  * delete link between current node and neighbor at index $pNeighborIndex
  * @param integer $pNeighborIndex
  * @return boolean|Node
  */
 protected function _deleteNeighborLinkAt($pNeighborIndex)
 {
     $lOldNeighbor = parent::_deleteNeighborLinkAt($pNeighborIndex);
     if ($lOldNeighbor) {
         $lOldNeighbor->deleteNeighbor($this->mCurrentNode);
     }
     return $lOldNeighbor;
 }
Frequently Used Methods