コード例 #1
0
ファイル: WordChart.php プロジェクト: sunxfancy/Questionnaire
 public function barGraph_2($data, $examinee_id, $color = 'green')
 {
     require_once '../app/classes/jpgraph/jpgraph_bar.php';
     // Create the graph. These two calls are always required
     $graph = new Graph(400, 334);
     $graph->SetScale('textlin');
     $graph->SetShadow(true, 5, 'white');
     // Adjust the margin a bit to make more room for titles
     $graph->SetMargin(40, 30, 20, 40);
     $graph->SetFrame(true, 'black', 1);
     // Create a bar pot
     $datay = array();
     $datalabel = array();
     foreach ($data as $value) {
         $datay[] = $value['score'];
         $datalabel[] = $value['chs_name'];
     }
     $bplot = new BarPlot($datay);
     // Adjust fill color
     $bplot->SetFillColor($color);
     $bplot->SetShadow("white");
     $graph->Add($bplot);
     // Setup labels
     $lbl = $datalabel;
     $graph->xaxis->SetTickLabels($lbl);
     $graph->xaxis->SetFont(FF_CHINESE, FS_BOLD, 12);
     // Send back the HTML page which will call this script again
     // to retrieve the image.
     //临时文件命名规范    $examinee_id_$date_rand(100,900)
     $date = date('H_i_s');
     $stamp = rand(100, 900);
     $fileName = './tmp/' . $examinee_id . '_' . $date . '_' . $stamp . '.jpeg';
     $graph->Stroke($fileName);
     return $fileName;
 }
コード例 #2
0
ファイル: graphs.php プロジェクト: neymanna/fusionforge
/**
 * 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();
}
コード例 #3
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);
 }
コード例 #4
0
ファイル: jpgraph_pi.php プロジェクト: JosephMokano/somu-nhr
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;
}
コード例 #5
0
ファイル: jpgraph.php プロジェクト: boriscy/upsys
 /**
  *Funcion que crea graficas tipo Barra
  *@param array() $data Array en el cual estan los datos para Y array(1, 2.3, 3, 4)
  *@param string $legend Título de los datos de la Barra
  *@param string $color Color de la Barra
  */
 function Bar($data, $legend = null, $color = '#000000')
 {
     vendor('jpgraph/jpgraph_bar');
     $bar = new BarPlot($data);
     $bar->SetFillColor($color);
     $bar->Legend($legend);
     $this->graph->Add($bar);
 }
コード例 #6
0
 function execute()
 {
     $this->set_title('Statistics Center');
     $this->tree('Statistics Center');
     if (!extension_loaded('gd')) {
         return $this->message('JpGraph Error', 'You need to install the correct GD libraries to run the Statistics centre (GD Libraries were not detected)');
     }
     include '../lib/jpgraph/jpgraph.php';
     include '../lib/jpgraph/jpgraph_bar.php';
     if (!defined('IMG_PNG')) {
         return $this->message('JpGraph Error', 'This PHP installation is not configured with PNG support. Please recompile PHP with GD and JPEG support to run JpGraph. (Constant IMG_PNG does not exist)');
     }
     /**
      * Posts
      */
     $query = $this->db->query("\r\n\t\tSELECT\r\n\t\t    COUNT(post_id) AS posts,\r\n\t\t    FROM_UNIXTIME(post_time, '%b %y') AS month\r\n\t\tFROM {$this->pre}posts\r\n\t\tGROUP BY month\r\n\t\tORDER BY post_time");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['posts'];
     }
     if (!$data) {
         $data = array(0, 0);
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set('Posts by Month');
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}1.png");
     /**
      * Registrations
      */
     $query = $this->db->query("\r\n\t\tSELECT\r\n\t\t    COUNT(user_id) AS users,\r\n\t\t    FROM_UNIXTIME(user_joined, '%b %y') AS month\r\n\t\tFROM {$this->pre}users\r\n\t\tWHERE user_joined != 0\r\n\t\tGROUP BY month\r\n\t\tORDER BY user_joined");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['users'];
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set('Registrations by Month');
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}2.png");
     return $this->message('Statistics Center', "<img src='{$this->time}1.png' alt='Posts by Month' /><br /><br />\r\n\t\t<img src='{$this->time}2.png' alt='Registrations by Month' />");
 }
コード例 #7
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();
 }
コード例 #8
0
ファイル: stats.php プロジェクト: BackupTheBerlios/qsf-svn
 function execute()
 {
     $this->set_title($this->lang->stats);
     $this->tree($this->lang->stats);
     include '../lib/jpgraph/jpgraph.php';
     include '../lib/jpgraph/jpgraph_bar.php';
     if (!defined('IMG_PNG')) {
         JpGraphError::Raise("This PHP installation is not configured with PNG support. Please recompile PHP with GD and JPEG support to run JpGraph. (Constant IMG_PNG does not exist)");
     }
     /**
      * Posts
      */
     $query = $this->db->query("SELECT COUNT(post_id) AS posts, FROM_UNIXTIME(post_time, '%%b %%y') AS month\n\t\t\tFROM %pposts GROUP BY month\tORDER BY post_time");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['posts'];
     }
     if (!$data) {
         $data = array(0, 0);
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_post_by_month);
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("../stats/{$this->time}1.png");
     /**
      * Registrations
      */
     $query = $this->db->query("SELECT COUNT(user_id) AS users, FROM_UNIXTIME(user_joined, '%%b %%y') AS month\n\t\t\tFROM %pusers\n\t\t\tWHERE user_joined != 0\n\t\t\tGROUP BY month\n\t\t\tORDER BY user_joined");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['users'];
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_reg_by_month);
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("../stats/{$this->time}2.png");
     return $this->message($this->lang->stats, "<img src='../stats/{$this->time}1.png' alt='{$this->lang->stats_post_by_month}' /><br /><br />\n\t\t<img src='../stats/{$this->time}2.png' alt='{$this->lang->stats_reg_by_month}' />");
 }
コード例 #9
0
function makeGraph($x_data, $y_data, $num_results, $title = "Statistics", $graph_type = "bar", $graph_scale = "textint")
{
    // default graph info
    $width = 600;
    $height = 500;
    $top = 60;
    $bottom = 30;
    $left = 80;
    $right = 30;
    if ($graph_type != 'csv' && $num_results == 0) {
        header('Content-type: image/png');
        readfile($GLOBALS['BASE_DIR'] . '/images/no-calls.png');
        exit;
    }
    // Set the basic parameters of the graph
    switch ($graph_type) {
        case "line":
            //do line graph here
            break;
            // not really a graph, returns comma seperated values
        // not really a graph, returns comma seperated values
        case "csv":
            header("content-type: text/csv");
            header('Content-Disposition: attachment; filename="statistics.csv"');
            $columns = implode(',', $x_data);
            $rows = implode(',', $y_data);
            echo $columns . "\n" . $rows;
            break;
        case "bar":
        default:
            // bar is default
            $graph = new Graph($width, 90 + 10 * $num_results, 'auto');
            $graph->SetScale($graph_scale);
            // Nice shadow
            $graph->SetShadow();
            $graph->Set90AndMargin($left, $right, $top, $bottom);
            // Setup labels
            $graph->xaxis->SetTickLabels($x_data);
            // 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($y_data);
            $bplot->SetFillColor("#708090");
            $bplot->SetWidth(0.5);
            $bplot->SetYMin(0);
            //$bplot->SetYMin(1990);
            $graph->title->Set($title);
            $graph->Add($bplot);
            $graph->Stroke();
    }
}
コード例 #10
0
 /**
  *
  */
 public function summary($id)
 {
     $iterationAux;
     //try {
     $project = Project::findOrFail($id);
     $iterations = Iterations::where('projectid', '=', $id)->get();
     //foreach($iterations as $var){
     //  $iterationAux = $iterationAux . var_dump($var);
     //}
     //}catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
     //}
     //die;
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('bar');
     JpGraph\JpGraph::module('line');
     $datay = array(20, 30, 50, 80);
     $datay2 = array(30, 95, 70, 40);
     $datazero = array(0, 0, 0, 0);
     // Create the graph.
     $graph = new Graph(800, 500);
     $graph->title->Set('Example with 2 scale bars : ' . $project->name . ' : ' . $id . ' : ' . sizeof($iterations));
     // Setup Y and Y2 scales with some "grace"
     $graph->SetScale("textlin");
     $graph->SetY2Scale("lin");
     //$graph->yaxis->scale->SetGrace(30);
     //$graph->y2axis->scale->SetGrace(30);
     //$graph->ygrid->Show(true,true);
     $graph->ygrid->SetColor('gray', 'lightgray@0.5');
     // Setup graph colors
     $graph->SetMarginColor('white');
     $graph->y2axis->SetColor('darkred');
     // Create the "dummy" 0 bplot
     $bplotzero = new BarPlot($datazero);
     // Create the "Y" axis group
     $ybplot1 = new BarPlot($datay);
     $ybplot1->value->Show();
     $ybplot = new GroupBarPlot(array($ybplot1, $bplotzero));
     // Create the "Y2" axis group
     $ybplot2 = new BarPlot($datay2);
     $ybplot2->value->Show();
     $ybplot2->value->SetColor('darkred');
     $ybplot2->SetFillColor('darkred');
     $y2bplot = new GroupBarPlot(array($bplotzero, $ybplot2));
     // Add the grouped bar plots to the graph
     $graph->Add($ybplot);
     $graph->AddY2($y2bplot);
     $datax = array('A', 'B', 'C', 'D');
     $graph->xaxis->SetTickLabels($datax);
     // .. and finally stroke the image back to browser
     $graph->Stroke();
 }
コード例 #11
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;
 }
コード例 #12
0
ファイル: stats.php プロジェクト: BackupTheBerlios/qsf-svn
 function execute()
 {
     $this->set_title($this->lang->stats);
     $this->tree($this->lang->stats);
     include '../lib/jpgraph/jpgraph.php';
     include '../lib/jpgraph/jpgraph_bar.php';
     /**
      * Posts
      */
     $query = $this->db->query("\n\t\tSELECT\n\t\t    COUNT(post_id) AS posts,\n\t\t    FROM_UNIXTIME(post_time, '%b %y') AS month\n\t\tFROM {$this->pre}posts\n\t\tGROUP BY month\n\t\tORDER BY post_time");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['posts'];
     }
     if (!$data) {
         $data = array(0, 0);
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_post_by_month);
     $barplot = new BarPlot(array_values($data));
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}1.png");
     /**
      * Registrations
      */
     $query = $this->db->query("\n\t\tSELECT\n\t\t    COUNT(user_id) AS users,\n\t\t    FROM_UNIXTIME(user_joined, '%b %y') AS month\n\t\tFROM {$this->pre}users\n\t\tWHERE user_joined != 0\n\t\tGROUP BY month\n\t\tORDER BY user_joined");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['users'];
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_reg_by_month);
     $barplot = new BarPlot(array_values($data));
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}2.png");
     return $this->message($this->lang->stats, "<img src='{$this->time}1.png' alt='{$this->lang->stats_post_by_month}' /><br /><br />\n\t\t<img src='{$this->time}2.png' alt='{$this->lang->stats_reg_by_month}' />");
 }
コード例 #13
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;
 }
コード例 #14
0
 function render($imgType)
 {
     $this->graph->SetImgFormat($imgType);
     if ($this->chartType == 'piechart') {
         $plot = new PiePlot3d($this->value_r);
         $plot->SetTheme("sand");
         $plot->SetCenter(0.35);
         $plot->SetAngle(50);
         $plot->SetLegends($this->display_r);
         $plot->SetLabelType(PIE_VALUE_ADJPER);
     } else {
         $this->graph->xaxis->SetTickLabels($this->display_r);
         $plot = new BarPlot($this->value_r);
         $plot->SetWidth(0.5);
         $plot->SetFillColor("orange@0.75");
     }
     $this->graph->Add($plot);
     $this->graph->Stroke();
 }
コード例 #15
0
ファイル: Grafico.php プロジェクト: aeduc/mideteed
 public function grafico_2_bd()
 {
     require_once APPPATH . '/libraries/JpGraph/jpgraph_bar.php';
     $data1y = $this->id_asignacionprueba;
     $data2y = $this->curso_id_curso;
     $graph = new Graph(700, 360, "auto");
     $graph->SetScale("textlin");
     $graph->img->SetMargin(30, 30, 20, 65);
     $graph->ygrid->SetFill(true, '#fff', '#DDDDDD@0.5');
     $graph->SetMarginColor("#fff");
     $graph->SetFrame(true, '#fff', 1);
     $graph->SetBox(false);
     //$columnas_2 = array('Ext. Info Explicita','Ext. Info Implicita','Ref. Contenido Texto','Ref. Sobre Texto');
     //$graph->xaxis->SetTickLabels($columnas_2);
     $b1plot = new BarPlot($data1y);
     $b1plot->SetWeight(0);
     $b1plot->SetFillColor("#61A9F3");
     $b1plot->SetLegend("id asignacion");
     $b1plot->SetValuePos('center');
     $b2plot = new BarPlot($data2y);
     $b2plot->SetWeight(0);
     $b2plot->SetFillColor("#F381B9");
     $b2plot->SetLegend("id curso");
     $b2plot->SetValuePos('center');
     $gbplot = new AccBarPlot(array($b1plot, $b2plot));
     $graph->Add($gbplot);
     $b1plot->value->Show();
     $b2plot->value->Show();
     $b1plot->value->SetFormat('%d');
     $b2plot->value->SetFormat('%d');
     $graph->title->Set("Grafico 2 - de barras compuestas");
     $graph->legend->SetPos(0.5, 0.99, 'center', 'bottom');
     $graph->legend->SetFrameWeight(1);
     $graph->Stroke(_IMG_HANDLER);
     global $fileName_bd_2;
     $this->fileName_bd_2 = "assets/images/grafica_muestra_bd_2.jpg";
     $graph->img->Stream($this->fileName_bd_2);
     /*
     $graph->img->Headers();
     $graph->img->Stream();
     */
 }
コード例 #16
0
 public function iterationSummaryAux($id)
 {
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('bar');
     $datay = array(12, 26, 9, 17, 31);
     // Create the graph.
     // One minute timeout for the cached image
     // INLINE_NO means don't stream it back to the browser.
     $graph = new Graph(310, 250, '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($datay);
     // Create targets for the image maps. One for each column
     $targ = array("bar_clsmex1.php#1", "bar_clsmex1.php#2", "bar_clsmex1.php#3", "bar_clsmex1.php#4", "bar_clsmex1.php#5", "bar_clsmex1.php#6");
     $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d");
     $bplot->SetCSIMTargets($targ, $alts);
     $bplot->SetFillColor("orange");
     // Use a shadow on the bar graphs (just use the default settings)
     $bplot->SetShadow();
     $bplot->value->SetFormat(" \$ %2.1f", 70);
     $bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 9);
     $bplot->value->SetColor("blue");
     $bplot->value->Show();
     $graph->Add($bplot);
     $graph->title->Set("Image maps barex1");
     $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);
     // Send back the HTML page which will call this script again
     // to retrieve the image.
     $graph->StrokeCSIM();
 }
コード例 #17
0
ファイル: graficos.php プロジェクト: kpeet/Brotec_system_repo
 function grafico_barra()
 {
     $data1y = array(47, 80, 40, 116);
     $data2y = array(61, 30, 82, 105);
     $data3y = array(115, 50, 70, 93);
     // Create the graph. These two calls are always required
     $graph = new Graph(350, 200, 'auto');
     $graph->SetScale("textlin");
     $theme_class = new UniversalTheme();
     $graph->SetTheme($theme_class);
     $graph->yaxis->SetTickPositions(array(0, 30, 60, 90, 120, 150), array(15, 45, 75, 105, 135));
     $graph->SetBox(false);
     $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($data1y);
     $b2plot = new BarPlot($data2y);
     $b3plot = new BarPlot($data3y);
     // Create the grouped bar plot
     $gbplot = new GroupBarPlot(array($b1plot, $b2plot, $b3plot));
     // ...and add it to the graPH
     $graph->Add($gbplot);
     $b1plot->SetColor("white");
     $b1plot->SetFillColor("#cc1111");
     $b2plot->SetColor("white");
     $b2plot->SetFillColor("#11cccc");
     $b3plot->SetColor("white");
     $b3plot->SetFillColor("#1111cc");
     $graph->title->Set("Bar Plots");
     // Display the graph
     $graph_temp_directory = 'temp';
     // in the webroot (add directory to .htaccess exclude)
     $graph_file_name = 'test.png';
     $graph_file_location = $graph_temp_directory . '/' . $graph_file_name;
     $graph->Stroke($graph_file_location);
     // create the graph and write to file
     $data['graph'] = $graph_file_location;
     $this->load->view('supervisor/prueba', $data);
 }
コード例 #18
0
ファイル: Grafico.class.php プロジェクト: albatronic/hermes
 public function getGrafico()
 {
     $em = new EntityManager($_SESSION['project']['conection']);
     $em->query($this->query);
     $rows = $em->fetchResult();
     $nRegistros = $em->numRows();
     $em->desConecta();
     unset($em);
     foreach ($rows as $value) {
         $this->datosY[] = $value[$this->columnaY];
         $this->titulosX[] = $value[$this->columnaX];
     }
     $grafico = new Graph($this->ancho, $this->alto);
     $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($this->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($this->titulo);
     $grafico->xaxis->title->Set($this->tituloX);
     $grafico->yaxis->title->Set($this->tituloY);
     $grafico->title->SetFont(FF_FONT1, FS_BOLD);
     $grafico->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $grafico->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $grafico->xaxis->SetTickLabels($this->titulosX);
     // Se generada el archivo con el gráfico
     $archivo = "docs/docs" . $_SESSION['emp'] . "/tmp/" . md5(date('d-m-Y H:i:s')) . ".png";
     $grafico->Stroke($archivo);
     return $archivo;
 }
コード例 #19
0
function generate_image()
{
    global $percent, $legend;
    // Create the graph. These two calls are always required
    $graph = new Graph(550, 250);
    $graph->SetScale("textlin");
    $graph->yaxis->scale->SetGrace(20);
    $graph->xaxis->SetLabelmargin(5);
    $graph->xaxis->SetTickLabels($legend);
    $graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#BBCCFF@0.5');
    // Add a drop shadow
    $graph->SetShadow();
    // Adjust the margin a bit to make more room for titles
    $graph->img->SetMargin(50, 30, 20, 40);
    // Create a bar pot
    $bplot = new BarPlot($percent);
    // Adjust fill color
    $bplot->SetFillColor('#9999CC');
    $bplot->SetShadow();
    $bplot->value->Show();
    $bplot->value->SetFont(FF_ARIAL, FS_BOLD, 10);
    $bplot->value->SetAngle(45);
    $bplot->value->SetFormat('%0.0f');
    // Width
    $bplot->SetWidth(0.6);
    $graph->Add($bplot);
    // Setup the titles
    $graph->title->Set("PHP documentation");
    $graph->xaxis->title->Set("Language");
    $graph->yaxis->title->Set("Files up to date (%)");
    $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('../www/images/revcheck/info_revcheck_php_all_lang.png');
}
コード例 #20
0
ファイル: plotbanddensity_ex0.php プロジェクト: hcvcastro/pxp
<?php

// content="text/plain; charset=utf-8"
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_bar.php";
$datay = array(10, 29, 3, 6);
// Create the graph.
$graph = new Graph(200, 200);
$graph->SetScale('textlin');
$graph->SetMargin(25, 10, 20, 25);
$graph->SetBox(true);
// Add 10% grace ("space") at top and botton of Y-scale.
$graph->yscale->SetGrace(10);
// Create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetFillColor("lightblue");
$graph->ygrid->Show(false);
// .. and add the plot to the graph
$graph->Add($bplot);
// Add band
$band = new PlotBand(HORIZONTAL, BAND_3DPLANE, 15, 35, 'khaki4');
$band->SetDensity(10);
$band->ShowFrame(true);
$graph->AddBand($band);
// Set title
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph->title->SetColor('darkred');
$graph->title->Set('BAND_3DPLANE, Density=10');
$graph->Stroke();
コード例 #21
0
ファイル: COGstat.php プロジェクト: kojoty/opencaching-pl
 $bplot3->value->Show();
 // Must use TTF fonts if we want text at an arbitrary angle
 $bplot3->value->SetFont(FF_FONT1, FS_BOLD);
 $bplot3->value->SetAngle(0);
 $bplot3->value->SetFormat('%d');
 // Create the graph. These two calls are always required
 $graph4 = new Graph(740, 200, 'auto');
 $graph4->SetScale('textint', 0, max($y4) + max($y4) * 0.2, 0, 0);
 // Add a drop shadow
 $graph4->SetShadow();
 // Adjust the margin a bit to make more room for titles
 $graph4->SetMargin(50, 30, 30, 40);
 // Create a bar pot
 $bplot4 = new BarPlot($y4);
 // Adjust fill color
 $bplot4->SetFillColor('purple1');
 $graph4->Add($bplot4);
 // Setup the titles
 $descibe4 = iconv('UTF-8', 'ASCII//TRANSLIT', tr("octeam_stat_m_caches"));
 $graph4->title->Set($descibe4);
 $graph4->xaxis->title->Set(iconv('UTF-8', 'ASCII//TRANSLIT', tr('number_month')) . '2014/2015');
 $graph4->xaxis->SetTickLabels($x4);
 $graph4->yaxis->title->Set($ncaches);
 $graph4->title->SetFont(FF_FONT1, FS_BOLD);
 $graph4->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
 $graph4->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
 // Setup the values that are displayed on top of each bar
 $bplot4->value->Show();
 // Must use TTF fonts if we want text at an arbitrary angle
 $bplot4->value->SetFont(FF_FONT1, FS_BOLD);
 $bplot4->value->SetAngle(0);
コード例 #22
0
ファイル: hfc_list_entry.php プロジェクト: helio-vo/helio
$graph->SetScale('textlin');
$graph->title->Set('HFC list entry population');
$graph->yaxis->Hide();
$graph->yaxis->HideLabels();
$graph->img->SetMargin($margex, 1, 1, $marge);
$graph->SetFrame(true, 'black', 0);
$graph->SetBox(true, 'black', 0);
$graph->ygrid->SetWeight(0, 0);
$graph->xaxis->HideLine();
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetTextTickInterval(12, 0);
$graph->xaxis->SetLabelMargin(2);
// Now create a bar pot
$bplot = new BarPlot($datay_bid);
$bplot->SetFillColor('white');
// ...and add it to the graPH
$graph->Add($bplot);
$mgraph = new MGraph();
$xpos1 = 3;
$ypos1 = 0;
$xpos2 = 3;
$ypos2 = 100;
$mgraph->Add($graph, 3, 0);
for ($i = 0; $i < count($feat_graph); $i++) {
    $mgraph->Add($feat_graph[$i], 3, $height_bid + $i * $height);
}
$cnt = 0;
foreach ($datay as $feat_type => $val) {
    foreach ($val as $instrume => $res) {
        $mgraph->Add(create_graph_barplot($instrume, $res, $width, $height), 3, $height_bid + $cnt * $height);
コード例 #23
0
$graph->img->SetMargin(60, 30, 50, 40);
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 15);
$graph->title->Set("Cash flow ");
$graph->subtitle->Set("(Department X)");
// Show both X and Y grid
$graph->xgrid->Show(true, false);
// Add 10% grace ("space") at top and botton of Y-scale.
$graph->yscale->SetGrace(10, 10);
// Turn the tick mark out from the plot area
$graph->xaxis->SetTickDirection(SIDE_DOWN);
$graph->yaxis->SetTickDirection(SIDE_LEFT);
// Create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetFillColor("orange");
// Show the actual value for each bar on top/bottom
$bplot->ShowValue(true);
$bplot->SetValueFormat("%02d kr");
// Position the X-axis at the bottom of the plotare
$graph->xaxis->SetPos("min");
// .. and add the plot to the graph
$graph->Add($bplot);
// Add band
$graph->AddBand(new PlotBand(HORIZONTAL, BAND_LHOR, 0, 10));
//$graph->title->Set("Test of bar gradient fill");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
$graph->Stroke();
コード例 #24
0
ファイル: img2.php プロジェクト: hichem/emblinux_website
// AXE Y
$graph4->yaxis->SetFont(FF_FONT1, FS_BOLD);
$graph4->yaxis->SetColor('black');
$graph4->yaxis->title->Set('time(nano-sec)');
$graph4->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph4->ygrid->SetColor('black');
$graph4->yaxis->SetTitleMargin(45);
$graph4->yaxis->scale->SetGrace(30);
// TITRE: texte
$graph4->title->Set("Mesuring latency Mod operation (nano-sec)");
// TITRE: marge et apparence
$graph4->title->SetFont(FF_FONT1, FS_BOLD, 11);
// Couleurs et transparence par histogramme
$bplot4 = new BarPlot($data5);
$bplot4->value->Show();
$bplot4->SetFillColor('blue');
$bplot4->value->SetFormat('%01.3f');
$bplot4->value->SetColor("black", "darkred");
$bplot4->SetShadow('black');
$bplot4->SetWidth(0.3);
$graph4->Add($bplot4);
//-----------------------
// Create a multigraph
//----------------------
$mgraph = new MGraph();
$mgraph->SetMargin(10, 10, 10, 10);
$mgraph->SetFrame(true, 'darkgray', 2);
$mgraph->SetBackgroundImage('../fond.png');
$mgraph->AddMix($graph, 0, 0, 85);
$mgraph->AddMix($graph1, 0, 270, 85);
$mgraph->AddMix($graph2, 0, 540, 85);
コード例 #25
0
ファイル: example24.php プロジェクト: Lazaro-Gallo/psmn
$data2y = array(8, 2, 11, 7, 14, 4);
$data3y = array(3, 9, 2, 7, 5, 8);
$data4y = array(1, 5, 11, 2, 14, 4);
// Create the graph. These two calls are always required
$graph = new Graph(310, 200);
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(40, 30, 20, 40);
$b1plot = new BarPlot($data1y);
$b1plot->SetFillColor("orange");
$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("blue");
$b3plot = new BarPlot($data3y);
$b3plot->SetFillColor("green");
$b4plot = new BarPlot($data4y);
$b4plot->SetFillColor("brown");
// Create the accumulated bar plots
$ab1plot = new AccBarPlot(array($b1plot, $b2plot));
$ab2plot = new AccBarPlot(array($b3plot, $b4plot));
// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($ab1plot, $ab2plot));
// ...and add it to the graph
$graph->Add($gbplot);
$graph->title->Set("Grouped Accumulated bar plots");
$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);
// Display the graph
$graph->Stroke();
コード例 #26
0
ファイル: bar_csimex3.php プロジェクト: rcroxyosox/jobtracker
$graph->yaxis->SetTitleMargin(30);

// Arrange the labels
$graph->yaxis->SetLabelSide(SIDE_RIGHT);
$graph->yaxis->SetLabelAlign('center','top');

// Create the bar plots with image maps
$b1plot = new BarPlot($data1y);
$b1plot->SetFillColor("orange");
$targ=array("bar_clsmex2.php#1","bar_clsmex2.php#2","bar_clsmex2.php#3",
            "bar_clsmex2.php#4","bar_clsmex2.php#5","bar_clsmex2.php#6");
$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d");
$b1plot->SetCSIMTargets($targ,$alts);

$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("blue");
$targ=array("bar_clsmex2.php#7","bar_clsmex2.php#8","bar_clsmex2.php#9",
            "bar_clsmex2.php#10","bar_clsmex2.php#11","bar_clsmex2.php#12");
$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d");
$b2plot->SetCSIMTargets($targ,$alts);

// Create the accumulated bar plot
$abplot = new AccBarPlot(array($b1plot,$b2plot));
$abplot->SetShadow();

// We want to display the value of each bar at the top
$abplot->value->Show();
$abplot->value->SetFont(FF_FONT1,FS_NORMAL);
$abplot->value->SetAlign('left','center');
$abplot->value->SetColor("black","darkred");
$abplot->value->SetFormat('%.1f mkr');
コード例 #27
0
ファイル: chartService.php プロジェクト: que273/siremis
 /**
  * Draw the XY type plot
  *
  * @param array $data plot data array reference
  * @param array $xmlArr xml array reference
  * @return object refernce XY plot object reference
  */
 public function renderXYPlot(&$data, &$xmlArr)
 {
     $id = $xmlArr['ATTRIBUTES']['ID'];
     $field = $xmlArr['ATTRIBUTES']['FIELD'];
     $chartType = $xmlArr['ATTRIBUTES']['CHARTTYPE'];
     $pointType = $xmlArr['ATTRIBUTES']['POINTTYPE'];
     $weight = $xmlArr['ATTRIBUTES']['WEIGHT'];
     $color = $xmlArr['ATTRIBUTES']['COLOR'];
     $fillColor = $xmlArr['ATTRIBUTES']['FILLCOLOR'];
     $showVal = $xmlArr['ATTRIBUTES']['SHOWVALUE'];
     $legend = $xmlArr['ATTRIBUTES']['LEGENDFIELD'];
     $visible = $xmlArr['ATTRIBUTES']['VISIBLE'];
     if ($chartType == 'Line' or $chartType == 'Bar') {
         if ($chartType == 'Line') {
             include_once JPGRAPH_DIR . '/jpgraph_line.php';
             $plot = new LinePlot($data);
             $this->_drawMark($plot->mark, $xmlArr['POINTMARK']['ATTRIBUTES']['TYPE'], $xmlArr['POINTMARK']['ATTRIBUTES']['COLOR'], $xmlArr['POINTMARK']['ATTRIBUTES']['FILLCOLOR'], $xmlArr['POINTMARK']['ATTRIBUTES']['SIZE']);
             $plot->SetBarCenter();
             $plot->SetCenter();
         } else {
             if ($chartType == 'Bar') {
                 include_once JPGRAPH_DIR . '/jpgraph_bar.php';
                 $plot = new BarPlot($data);
                 $plot->SetAlign('center');
             }
         }
         if ($color) {
             $plot->SetColor($color);
         }
         if ($fillColor) {
             $plot->SetFillColor($fillColor);
         }
         if ($weight) {
             $plot->SetWeight($weight);
         }
         if ($showVal == 1) {
             $plot->value->Show();
         }
         if ($legend) {
             $plot->SetLegend($legend);
         }
         $this->_drawString($plot->value, $xmlArr['VALUE']['ATTRIBUTES']['FONT'], $xmlArr['VALUE']['ATTRIBUTES']['COLOR']);
     }
     if ($chartType == 'GroupBar' or $chartType == 'AccBar') {
         $children = $xmlArr['ATTRIBUTES']['CHILDREN'];
         $childList = explode(",", $children);
         foreach ($childList as $child) {
             $childPlotList[] = $this->m_PlotList[$child];
         }
         if ($chartType == 'GroupBar') {
             $plot = new GroupBarPlot($childPlotList);
         } else {
             if ($chartType == 'AccBar') {
                 $plot = new AccBarPlot($childPlotList);
             }
         }
     }
     $this->m_PlotList[$id] = $plot;
     if ($visible == 1) {
         return $plot;
     }
     return null;
 }
コード例 #28
0
        $abar1 = new AccBarPlot(array($bar2, $bar3));
    }
    $gbplot = new GroupBarPlot(array($bar1, $abar1));
    $graph->Add($gbplot);
    $graph->AddY2($line1);
    $bar1->SetColor('blue');
    $bar1->SetFillColor('blue');
    $bar1->SetLegend('Mail');
    $bar2->SetColor('orange');
    $bar2->SetFillColor('orange');
    $bar2->SetLegend('Viruses');
    $bar3->SetColor('red');
    $bar3->SetFillColor('red');
    $bar3->SetLegend('Spam');
    if ($is_MCP_enabled === true) {
        $bar4->SetFillColor('lightblue');
        $bar4->SetLegend('MCP');
    }
    $line1->SetColor('lightgreen');
    $line1->SetFillColor('lightgreen');
    $line1->SetLegend('Volume (' . $size_info['shortdesc'] . ')');
    $line1->SetCenter();
    $graph->Stroke($filename);
}
// HTML Code to display the graph
echo "<TABLE BORDER=\"0\" CELLPADDING=\"10\" CELLSPACING=\"0\" WIDTH=\"100%\">\n";
echo " <TR><TD ALIGN=\"CENTER\"><IMG SRC=\"" . IMAGES_DIR . "mailscannerlogo.gif\" ALT=\"MailScanner Logo\"></TD></TR>";
echo " <TR>\n";
//  Check Permissions to see if the file has been written and that apache to read it.
if (is_readable($filename)) {
    echo " <TD ALIGN=\"CENTER\"><IMG SRC=\"" . $filename . "\" ALT=\"Graph\"></TD>";
コード例 #29
0
ファイル: img10.php プロジェクト: hichem/emblinux_website
$graph->yaxis->title->Set('(%)');
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->ygrid->SetColor('black');
$graph->yaxis->SetTitleMargin(45);
$graph->yaxis->scale->SetGrace(30);
// TITRE: texte
$graph->title->Set("Pass and Fail rate");
// TITRE: marge et apparence
$graph->title->SetFont(FF_FONT1, FS_BOLD, 10);
// Couleurs et transparence par histogramme
$aColors = array('pink', 'teal', 'navy', 'lightblue', 'red', 'green');
$i = 0;
$aGroupBarPlot = array();
foreach ($data1 as $key => $value) {
    $bplot = new BarPlot($data1[$key]);
    $bplot->SetFillColor($aColors[$i++]);
    $bplot->value->Show();
    $bplot->value->SetFormat('%01.2f');
    $bplot->value->SetColor("black", "darkred");
    $bplot->SetLegend($key);
    $bplot->SetShadow('black');
    $bplot->SetWidth(0.2);
    $aGroupBarPlot[] = $bplot;
}
// Création de l'objet qui regroupe nos histogrammes
$gbarplot = new GroupBarPlot($aGroupBarPlot);
$gbarplot->SetWidth(0.5);
// Ajouter au graphique
$graph->Add($gbarplot);
// Afficher
$graph->Stroke();
コード例 #30
0
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->y2axis->SetTickSide(SIDE_RIGHT);
$graph->y2axis->SetColor('black', 'blue');
$graph->y2axis->SetLabelFormat('%3d.0%%');
// Create a bar pot
$bplot = new BarPlot($data_freq);
// Create targets and alt texts for the image maps. One for each bar
// (In this example this is just "dummy" targets)
$targ = array("#1", "#2", "#3", "#4", "#5", "#6", "#7");
$alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d");
$bplot->SetCSIMTargets($targ, $alts);
// Create accumulative graph
$lplot = new LinePlot($data_accfreq);
// We want the line plot data point in the middle of the bars
$lplot->SetBarCenter();
// Use transperancy
$lplot->SetFillColor('lightblue@0.6');
$lplot->SetColor('blue@0.6');
//$lplot->SetColor('blue');
$graph->AddY2($lplot);
// Setup the bars
$bplot->SetFillColor("orange@0.2");
$bplot->SetValuePos('center');
$bplot->value->SetFormat("%d");
$bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 9);
$bplot->value->Show();
// Add it to the graph
$graph->Add($bplot);
// Send back the HTML page which will call this script again
// to retrieve the image.
$graph->StrokeCSIM();