PHP Classes

File: src/php/Netcrash/cwGraph/example/example.php

Recommend this page to a friend!
  Classes of Fernando André   cwGraph   src/php/Netcrash/cwGraph/example/example.php   Download  
File: src/php/Netcrash/cwGraph/example/example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: cwGraph
Generate Bar, Pie, Line graph images
Author: By
Last change:
Date: 7 years ago
Size: 1,397 bytes
 

Contents

Class file image Download
<?php
/**
 * Basic example for pChart usage with cwGraph
 *
 *
 */

$Data = array();
if (
count($Data) > 0 ){
   
$cwgraph = new cwGraph();
   
$cwgraph->setHeight(180)->setWidth(400);
   
$cwgraph->setData($Data)->setTitle("Comandos emitidos por dia entre $datainicio e $datafim");
   
$cwgraph->setX("Data criado", "datacriado")->setAnguloTextoX(40);
   
$cwgraph->addVariavel("Data criado", "datacriado");
   
$cwgraph->addVariavel("Total", "total");

   
$cwgraph->drawByEngine();
    print
'<img src="../../../data/'.$cwgraph->getFilename().'" /><br>';
}


if (
count($DataG) > 0 ){
   
$cwgraph = new cwGraph("bar");
   
$cwgraph->setHeight(180)->setWidth(400);
   
$cwgraph->setData($DataG);//->setTitle("Total de comandos por estado");
   
$cwgraph->setX("Data criado", "datacriado")->setAnguloTextoX(40);
   
$cwgraph->addVariavel("Data criado", "datacriado");
   
$cwgraph->addVariavel("Total", "total");
   
$cwgraph->drawByEngine();
    print
'<img src="'.$cwgraph->getFilename().'" /><br>';
}

$Data = array();
$total = 0;

if (
count($DataA) > 0 ){
   
$cwgraph = new cwGraph("pie");
   
$cwgraph->setData($DataA)->setHeight(150)->setWidth(200);
   
$cwgraph->setX("Estados", "estado");
   
$cwgraph->setPieAngle()->setPieGapRadius();
   
$cwgraph->setDisplayValues(true);

   
$cwgraph->addVariavel("total", "total");
   
$cwgraph->addVariavel("Estados", "estado");

   
$cwgraph->drawByEngine();
    print
'<img src="'.$cwgraph->getFilename().'" /><br>';
}