Graph PHP Class Code Examples

This page contains top rated real world PHP examples of class Graph extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: Graph.php Project: nagyist/Tattle
0
 public static function cloneGraph($graph_id, $dashboard_id = NULL)
 {
     $graph_to_clone = new Graph($graph_id);
     if (empty($dashboard_id)) {
         $dashboard_id = $graph_to_clone->getDashboardId();
     }
     $graph = new Graph();
     $clone_name = 'Clone of ' . $graph_to_clone->getName();
     // If it's too long, we truncate
     if (strlen($clone_name) > 255) {
         $clone_name = substr($clone_name, 0, 255);
     }
     $graph->setName($clone_name);
     $graph->setArea($graph_to_clone->getArea());
     $graph->setVtitle($graph_to_clone->getVtitle());
     $graph->setDescription($graph_to_clone->getDescription());
     $graph->setDashboardId($dashboard_id);
     $graph->setWeight($graph_to_clone->getWeight());
     $graph->setTimeValue($graph_to_clone->getTimeValue());
     $graph->setUnit($graph_to_clone->getUnit());
     $graph->setCustomOpts($graph_to_clone->getCustomOpts());
     $graph->setStartsAtMidnight($graph_to_clone->getStartsAtMidnight());
     $graph->store();
     // Clone of the lines
     $lines = Line::findAll($graph_id);
     foreach ($lines as $line_to_clone) {
         Line::cloneLine($line_to_clone->getLineId(), TRUE, $graph->getGraphId());
     }
 }
Example #2
Show file File: mensuales.php Project: codethics/proteoerp
0
 function grafico($mes = NULL, $anio = NULL)
 {
     if (empty($mes) and empty($anio)) {
         return;
     }
     $this->load->library('Graph');
     $titulo = $data_1 = $data_2 = $data_3 = $data_tips_1 = $data_tips_2 = $data_tips_3 = array();
     $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
     $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
     $data = $this->_sincrodata($fechai, $fechaf);
     $om = 1;
     while ($this->maxval / $om > 100) {
         $om = $om * 10;
     }
     foreach ($data as $row) {
         $titulo[] = $row['dia'];
         $data_1[] = $row['contado'] / $om;
         $data_2[] = $row['credito'] / $om;
         $data_3[] = $row['cobrado'] / $om;
         $data_tips_1[] = graph::esc(number_format($row['contado'], 2, ',', '.'));
         $data_tips_2[] = graph::esc(number_format($row['credito'], 2, ',', '.'));
         $data_tips_3[] = graph::esc(number_format($row['cobrado'], 2, ',', '.'));
     }
     $odata_1 = new bar_fade(50, '0xCC3399');
     $odata_1->key('Contado', 10);
     $odata_1->data = $data_1;
     $odata_1->tips = $data_tips_1;
     $odata_2 = new bar_fade(50, '0x80a033');
     $odata_2->key('Crédito', 10);
     $odata_2->data = $data_2;
     $odata_2->tips = $data_tips_2;
     $odata_3 = new line_hollow(2, 3, '0x9933CC');
     $odata_3->key('Cobranzas a Crédito', 10);
     $odata_3->data = $data_3;
     $odata_3->tips = $data_tips_3;
     $g = new Graph();
     if ($this->maxval > 0) {
         $g->title('Ventas del mes ' . $mes . '/' . $anio, '{font-size:18px; color: #d01f3c}');
         $g->set_is_decimal_separator_comma(1);
         $g->data_sets[] = $odata_3;
         $g->data_sets[] = $odata_1;
         $g->data_sets[] = $odata_2;
         $g->set_y_max(ceil($this->maxval / $om));
         $g->y_label_steps(5);
         $g->set_x_labels($titulo);
         $ejey = number_format($om, 0, '', '.');
         $g->set_y_legend('Venta X ' . $ejey . ' (Bs)', 14, '0x639F45');
         $g->set_x_legend('Días del mes ' . $mes, 14, '0x639F45');
         $g->set_tool_tip('#key#<br>D&iacute;a: #x_label# <br>Monto: #tip#');
     } 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 utf8_encode($g->render());
 }
Example #3
Show file File: VerticesTest.php Project: cmfcmf/graph
0
 public function testDuplicates()
 {
     $graph = new Graph();
     $v1 = $graph->createVertex(1);
     $vertices = $this->createVertices(array($v1, $v1, $v1));
     $this->assertInstanceOf('Fhaculty\\Graph\\Set\\Vertices', $vertices);
     $this->assertCount(3, $vertices);
     $this->assertTrue($vertices->hasDuplicates());
     $verticesDistinct = $vertices->getVerticesDistinct();
     $this->assertInstanceOf('Fhaculty\\Graph\\Set\\Vertices', $verticesDistinct);
     $this->assertCount(1, $verticesDistinct);
     $this->assertFalse($verticesDistinct->hasDuplicates());
     $this->assertSame($verticesDistinct, $verticesDistinct->getVerticesDistinct());
 }
Example #4
Show file File: Graph.php Project: kirkbauer2/kirkxc
0
 /**
  * Visualize tree
  *
  * @param \Includes\DataStructure\Graph $root   Root node of current level OPTIONAL
  * @param integer                       $offset Level offset OPTIONAL
  *
  * @return void
  */
 public function draw(\Includes\DataStructure\Graph $root = null, $offset = 0)
 {
     // Recursive call support
     if (!isset($root)) {
         $root = $this;
     }
     // Walk through all nodes
     foreach ($root->getChildren() as $child) {
         // Output
         echo str_repeat('|__', floor($offset / 2)) . $child->getKey() . $this->drawAdditional($child) . '<br />';
         // Recursive call: next level
         $this->{__FUNCTION__}($child, $offset + 2);
     }
 }
Example #5
Show file File: GraphViz.php Project: johnulist/easyrdf
0
 /**
  * Serialise an EasyRdf\Graph into a GraphViz dot document.
  *
  * Supported output format names: dot, gif, png, svg
  *
  * @param Graph  $graph  An EasyRdf\Graph object.
  * @param string $format The name of the format to convert to.
  * @param array  $options
  *
  * @return string The RDF in the new desired format.
  * @throws Exception
  */
 public function serialise(Graph $graph, $format, array $options = array())
 {
     parent::checkSerialiseParams($format);
     switch ($format) {
         case 'dot':
             return $this->serialiseDot($graph);
         case 'png':
         case 'gif':
         case 'svg':
             return $this->renderImage($graph, $format);
         default:
             throw new Exception("EasyRdf\\Serialiser\\GraphViz does not support: {$format}");
     }
 }
Example #6
Show file File: report_top_clicked_categories.php Project: ioanok/symfoxid
0
 /**
  * Current week top viewed categories report
  */
 public function graph1()
 {
     $myConfig = $this->getConfig();
     $oDb = oxDb::getDb();
     $aDataX = array();
     $aDataY = array();
     $sTimeFromParameter = oxRegistry::getConfig()->getRequestParameter("time_from");
     $sTimeToParameter = oxRegistry::getConfig()->getRequestParameter("time_to");
     $sTimeFrom = $oDb->quote(date("Y-m-d H:i:s", strtotime($sTimeFromParameter)));
     $sTimeTo = $oDb->quote(date("Y-m-d H:i:s", strtotime($sTimeToParameter)));
     $sSQL = "select count(*) as nrof, oxparameter from oxlogs where oxclass = 'search' " . "and oxtime >= {$sTimeFrom} and oxtime <= {$sTimeTo} group by oxparameter order by nrof desc";
     $rs = $oDb->execute($sSQL);
     if ($rs != false && $rs->recordCount() > 0) {
         while (!$rs->EOF) {
             if ($rs->fields[1]) {
                 $aDataX[] = $rs->fields[0];
                 $aDataY[] = $rs->fields[1];
             }
             $rs->moveNext();
         }
     }
     header("Content-type: image/png");
     // New graph with a drop shadow
     $graph = new Graph(800, max(640, 20 * count($aDataX)));
     $graph->setBackgroundImage($myConfig->getImageDir(true) . "/reportbgrnd.jpg", BGIMG_FILLFRAME);
     // Use a "text" X-scale
     $graph->setScale("textlin");
     $top = 60;
     $bottom = 30;
     $left = 80;
     $right = 30;
     $graph->set90AndMargin($left, $right, $top, $bottom);
     // Label align for X-axis
     $graph->xaxis->setLabelAlign('right', 'center', 'right');
     // Label align for Y-axis
     $graph->yaxis->setLabelAlign('center', 'bottom');
     $graph->setShadow();
     // Description
     $graph->xaxis->setTickLabels($aDataY);
     // Set title and subtitle
     $graph->title->set("Suchw�rter");
     // Use built in font
     $graph->title->setFont(FF_FONT1, FS_BOLD);
     // Create the bar plot
     $bplot = new BarPlot($aDataX);
     $bplot->setFillGradient("navy", "lightsteelblue", GRAD_VER);
     $bplot->setLegend("Hits");
     $graph->add($bplot);
     // Finally output the  image
     $graph->stroke();
 }
Example #7
Show file File: GraphTest.php Project: cmfcmf/graph
0
 public function testCreateGraphCloneVertices()
 {
     // 1 -- 2 -- 3
     $graph = new Graph();
     $v1 = $graph->createVertex(1);
     $v2 = $graph->createVertex(2);
     $v3 = $graph->createVertex(3);
     $e1 = $v1->createEdgeTo($v2);
     $e2 = $v2->createEdgeTo($v3);
     $graphClone = $graph->createGraphCloneVertices(array(1 => $v1, 2 => $v2));
     $this->assertEquals(2, count($graphClone->getVertices()));
     $this->assertEquals(1, count($graphClone->getEdges()));
 }
Example #8
Show file File: GraphStore.php Project: johnulist/easyrdf
0
 /** Fetch a named graph from the graph store
  *
  * The URI can either be a full absolute URI or
  * a URI relative to the URI of the graph store.
  *
  * @param string $uriRef The URI of graph desired
  *
  * @return Graph The graph requested
  */
 public function get($uriRef)
 {
     if ($uriRef === self::DEFAULT_GRAPH) {
         $dataUrl = $this->urlForGraph(self::DEFAULT_GRAPH);
         $graph = new Graph();
     } else {
         $graphUri = $this->parsedUri->resolve($uriRef)->toString();
         $dataUrl = $this->urlForGraph($graphUri);
         $graph = new Graph($graphUri);
     }
     $graph->load($dataUrl);
     return $graph;
 }
Example #9
Show file File: bootstrap.php Project: cmfcmf/graph
0
 protected function assertGraphEquals(Graph $expected, Graph $actual)
 {
     $f = function (Graph $graph) {
         $ret = get_class($graph);
         $ret .= PHP_EOL . 'vertices: ' . count($graph->getVertices());
         $ret .= PHP_EOL . 'edges: ' . count($graph->getEdges());
         return $ret;
     };
     // assert graph base parameters are equal
     $this->assertEquals($f($expected), $f($actual));
     // next, assert that all vertices in both graphs are the same
     // each vertex has a unique ID, therefor it's easy to search a matching partner
     // do not use assertVertexEquals() in order to not increase assertion counter
     foreach ($expected->getVertices()->getMap() as $vid => $vertex) {
         try {
             $other = $actual->getVertex($vid);
         } catch (Exception $e) {
             $this->fail();
         }
         if ($this->getVertexDump($vertex) !== $this->getVertexDump($vertex)) {
             $this->fail();
         }
     }
     // next, assert that all edges in both graphs are the same
     // assertEdgeEquals() does not work, as the order of the edges is unknown
     // therefor, build an array of edge dump and make sure each entry has a match
     $edgesExpected = array();
     foreach ($expected->getEdges() as $edge) {
         $edgesExpected[] = $this->getEdgeDump($edge);
     }
     foreach ($actual->getEdges() as $edge) {
         $dump = $this->getEdgeDump($edge);
         $pos = array_search($dump, $edgesExpected, true);
         if ($pos === false) {
             $this->fail('given edge ' . $dump . ' not found');
         } else {
             unset($edgesExpected[$pos]);
         }
     }
 }
Example #10
Show file File: EdgesTest.php Project: cmfcmf/graph
0
 public function testIntersectionDuplicates()
 {
     $graph = new Graph();
     $v1 = $graph->createVertex(1);
     $v2 = $graph->createVertex(2);
     $e1 = $v1->createEdge($v2);
     $edges1 = $this->createEdges(array($e1, $e1, $e1));
     $edges2 = $this->createEdges(array($e1, $e1));
     $edges3 = $edges1->getEdgesIntersection($edges2);
     $this->assertCount(2, $edges3);
 }
Example #11
Show file File: Rapper.php Project: johnulist/easyrdf
0
 /**
  * Serialise an EasyRdf\Graph to the RDF format of choice.
  *
  * @param \EasyRdf\Graph $graph  An EasyRdf\Graph object.
  * @param string         $format The name of the format to convert to.
  * @param array          $options
  *
  * @return string The RDF in the new desired format.
  * @throws Exception
  */
 public function serialise(Graph $graph, $format, array $options = array())
 {
     parent::checkSerialiseParams($format);
     $ntriples = parent::serialise($graph, 'ntriples');
     // Hack to produce more concise RDF/XML
     if ($format == 'rdfxml') {
         $format = 'rdfxml-abbrev';
     }
     return Utils::execCommandPipe($this->rapperCmd, array('--quiet', '--input', 'ntriples', '--output', $format, '-', 'unknown://'), $ntriples);
 }
Example #12
Show file File: CommonGraph.php Project: kirkbauer2/kirkxc
0
 /**
  * Remove child node
  *
  * @param \Includes\DataStructure\Graph $node Node to remove
  *
  * @return void
  */
 public function removeChild(\Includes\DataStructure\Graph $node)
 {
     foreach ($this->getChildren() as $index => $child) {
         if ($node->getKey() === $child->getKey()) {
             $node->setParent(null);
         }
     }
     parent::removeChild($node);
 }
Example #13
Show file File: GraphGenerator.php Project: PublicityPort/OpenCATS
0
 public function draw($format = false)
 {
     /* Make sure we have GD support. */
     if (!function_exists('imagecreatefromjpeg')) {
         die;
     }
     if ($format === false) {
         $format = IMG_JPEG;
     }
     $graph = new Graph($this->width, $this->height);
     $graph->setFormat($format);
     $graph->setBackgroundColor(new Color(0xf4, 0xf4, 0xf4));
     $graph->shadow->setSize(6);
     $graph->title->set($this->title);
     $graph->title->setFont(new Tuffy(48));
     $graph->title->setColor(new Color(0x0, 0x0, 0x8b));
     $graph->border->setColor(new Color(187, 187, 187, 15));
     $plot = new BarPlotPipeline($this->xValues, 1, 1, 0, $this->totalValue, false);
     $plot->setPadding(40, 40, 15, 45);
     $plot->setBarColor(new DarkGreen());
     $plot->barBorder->hide(true);
     $plot->arrayBarBackground = $this->colorArray;
     $plot->xAxis->setLabelText($this->xLabels);
     $plot->xAxis->label->setFont(new Tuffy(24));
     $plot->yAxis->label->setFont(new Tuffy(18));
     $graph->add($plot);
     $graph->draw();
     die;
 }
Example #14
Show file File: AttributeBagNamespacedTest.php Project: cmfcmf/graph
0
 public function provideNamespacable()
 {
     $graph = new Graph();
     $vertex = $graph->createVertex();
     $bag = $vertex->getAttributeBag();
     $subNamespace = new AttributeBagNamespaced($bag, 'prefix');
     return array(array($graph), array($vertex), array($bag), array($subNamespace));
 }
Example #15
Show file File: EdgeAttributesTest.php Project: cmfcmf/graph
0
 public function setUp()
 {
     $graph = new Graph();
     $graph->createVertex(1);
     $graph->createVertex(2);
     // 1 -> 2
     $this->edge = $graph->getVertex(1)->createEdge($graph->getVertex(2));
 }
Example #16
Show file File: Json.php Project: johnulist/easyrdf
0
 /**
  * Serialise an EasyRdf\Graph into a to RDF/JSON document.
  *
  * http://n2.talis.com/wiki/RDF_JSON_Specification
  * docs/appendix-a-rdf-formats-json.md
  *
  * @param Graph  $graph  An EasyRdf\Graph object.
  * @param string $format The name of the format to convert to.
  * @param array  $options
  *
  * @return string The RDF in the new desired format.
  * @throws Exception
  */
 public function serialise(Graph $graph, $format, array $options = array())
 {
     parent::checkSerialiseParams($format);
     if ($format != 'json') {
         throw new Exception("EasyRdf\\Serialiser\\Json does not support: {$format}");
     }
     return json_encode(parent::serialise($graph, 'php'));
 }
Example #17
Show file File: Classes.php Project: kirkbauer2/kirkxc
0
 /**
  * For additional info
  *
  * @param \Includes\DataStructure\Graph $node Current node
  *
  * @return string
  */
 protected function drawAdditional(\Includes\DataStructure\Graph $node)
 {
     $result = parent::drawAdditional($node);
     if ($node->getParentClass()) {
         $result .= ' <i>(' . $node->getParentClass() . ')</i>';
     }
     return $result;
 }
Example #18
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 #19
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 #20
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 #21
Show file File: graphs.php Project: ckc6cz/ManhattanProject
0
 static function graphs($name, $close)
 {
     // Setup the graph
     $graph = new Graph(1000, 653, 'auto');
     $graph->SetScale("textlin");
     $theme_class = new UniversalTheme();
     $graph->SetTheme($theme_class);
     $graph->img->SetAntiAliasing(false);
     $graph->title->SetFont(FF_FONT2, FS_BOLD, 20);
     $graph->title->Set("Stock Performance History for " . $name);
     $graph->SetBox(false);
     $graph->yaxis->HideZeroLabel();
     $graph->yaxis->HideLine(false);
     $graph->yaxis->HideTicks(false, false);
     $graph->yaxis->title->SetFont(FF_FONT2, FS_BOLD, 20);
     $graph->yaxis->title->Set('Close Price');
     $graph->xgrid->Show();
     $graph->xgrid->SetLineStyle("solid");
     $graph->xaxis->SetTickPositions(array(0, 20, 40, 61, 82, 103, 124, 143));
     $graph->xaxis->SetTickLabels(array('Nov 2014', 'Dec 2014', 'Jan 2015', 'Feb 2015', 'March 2015', 'April 2015', 'May 2015', 'June 2015'));
     $graph->xaxis->title->SetFont(FF_FONT2, FS_BOLD, 20);
     $graph->xaxis->title->Set('Dates');
     $graph->xgrid->SetColor('#E3E3E3');
     // Create the first line
     $p1 = new LinePlot($close);
     $graph->Add($p1);
     $p1->SetColor("#6495ED");
     $graph->legend->SetFrameWeight(2);
     // Output line
     $graph->Stroke();
 }
Example #22
Show file File: jpgraph_pi.php Project: JosephMokano/somu-nhr
0
function barcart($datay)
{
    require_once "jpgraph/jpgraph.php";
    require_once "jpgraph/jpgraph_bar.php";
    // Setup the graph.
    $graph = new Graph(660, 250);
    $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);
    // Setup the titles
    $graph->title->Set('NHR Registry');
    $graph->xaxis->title->Set('X-title');
    $graph->yaxis->title->Set('Y-title');
    // Create the bar pot
    $bplot = new BarPlot($datay);
    // Adjust fill color
    $bplot->SetFillColor('orange');
    $graph->Add($bplot);
    $graph->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
    return $graph;
}
Example #23
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 #24
Show file File: MigrationStorage.php Project: isramv/camp-gdl
0
 /**
  * {@inheritdoc}
  */
 public function buildDependencyMigration(array $migrations, array $dynamic_ids)
 {
     // Migration dependencies defined in the migration storage can be
     // optional or required. If an optional dependency does not run, the current
     // migration is still OK to go. Both optional and required dependencies
     // (if run at all) must run before the current migration.
     $dependency_graph = array();
     $requirement_graph = array();
     $different = FALSE;
     foreach ($migrations as $migration) {
         /** @var \Drupal\migrate\Entity\MigrationInterface $migration */
         $id = $migration->id();
         $requirements[$id] = array();
         $dependency_graph[$id]['edges'] = array();
         $migration_dependencies = $migration->getMigrationDependencies();
         if (isset($migration_dependencies['required'])) {
             foreach ($migration_dependencies['required'] as $dependency) {
                 if (!isset($dynamic_ids[$dependency])) {
                     $this->addDependency($requirement_graph, $id, $dependency, $dynamic_ids);
                 }
                 $this->addDependency($dependency_graph, $id, $dependency, $dynamic_ids);
             }
         }
         if (isset($migration_dependencies['optional'])) {
             foreach ($migration_dependencies['optional'] as $dependency) {
                 $different = TRUE;
                 $this->addDependency($dependency_graph, $id, $dependency, $dynamic_ids);
             }
         }
     }
     $graph_object = new Graph($dependency_graph);
     $dependency_graph = $graph_object->searchAndSort();
     if ($different) {
         $graph_object = new Graph($requirement_graph);
         $requirement_graph = $graph_object->searchAndSort();
     } else {
         $requirement_graph = $dependency_graph;
     }
     $weights = array();
     foreach ($migrations as $migration_id => $migration) {
         // Populate a weights array to use with array_multisort later.
         $weights[] = $dependency_graph[$migration_id]['weight'];
         if (!empty($requirement_graph[$migration_id]['paths'])) {
             $migration->set('requirements', $requirement_graph[$migration_id]['paths']);
         }
     }
     array_multisort($weights, SORT_DESC, SORT_NUMERIC, $migrations);
     return $migrations;
 }