[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/ -> benchmark.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */
   3  // +----------------------------------------------------------------------+
   4  // | Eventum - Issue Tracking System                                      |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 2003, 2004, 2005, 2006, 2007 MySQL AB                  |
   7  // |                                                                      |
   8  // | This program is free software; you can redistribute it and/or modify |
   9  // | it under the terms of the GNU General Public License as published by |
  10  // | the Free Software Foundation; either version 2 of the License, or    |
  11  // | (at your option) any later version.                                  |
  12  // |                                                                      |
  13  // | This program is distributed in the hope that it will be useful,      |
  14  // | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
  15  // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
  16  // | GNU General Public License for more details.                         |
  17  // |                                                                      |
  18  // | You should have received a copy of the GNU General Public License    |
  19  // | along with this program; if not, write to:                           |
  20  // |                                                                      |
  21  // | Free Software Foundation, Inc.                                       |
  22  // | 59 Temple Place - Suite 330                                          |
  23  // | Boston, MA 02111-1307, USA.                                          |
  24  // +----------------------------------------------------------------------+
  25  // | Authors: João Prado Maia <jpm@mysql.com>                             |
  26  // +----------------------------------------------------------------------+
  27  //
  28  // @(#) $Id: benchmark.php 3258 2007-02-14 23:25:56Z glen $
  29  
  30  require_once(dirname(__FILE__) . "/init.php");
  31  require_once (APP_INC_PATH . "db_access.php");
  32  
  33  error_reporting(E_ALL);
  34  require_once(APP_JPGRAPH_PATH . "jpgraph.php");
  35  require_once(APP_JPGRAPH_PATH . "jpgraph_pie.php");
  36  
  37  $font = FF_FONT1;
  38  
  39  $stats = unserialize(base64_decode($_POST["encoded_stats"]));
  40  $labels = array();
  41  $data = array();
  42  foreach ($stats as $point) {
  43      if ($point["name"] != "Start") {
  44          $labels[] = $point["name"] . " (" . $point["diff"] . ")";
  45          $data[] = (float) $point["diff"];
  46      }
  47  }
  48  
  49  // A new graph
  50  $graph = new PieGraph(750, 500, "auto");
  51  
  52  // Setup title
  53  $graph->title->Set("Benchmark Results");
  54  $graph->title->SetFont($font, FS_BOLD, 12);
  55  
  56  // The pie plot
  57  $p1 = new PiePlot($data);
  58  $p1->SetTheme('pastel');
  59  
  60  // Move center of pie to the left to make better room
  61  // for the legend
  62  $p1->SetCenter(0.26,0.55);
  63  
  64  // Label font and color setup
  65  $p1->SetFont($font, FS_BOLD);
  66  $p1->SetFontColor("black");
  67  
  68  // Use absolute values (type==1)
  69  $p1->SetLabelType(1);
  70  
  71  // Label format
  72  $p1->SetLabelFormat("%.5f");
  73  
  74  // Size of pie in fraction of the width of the graph
  75  $p1->SetSize(0.3);
  76  
  77  // Legends
  78  $p1->SetLegends($labels);
  79  $graph->legend->SetFont($font);
  80  $graph->legend->Pos(0.06,0.10);
  81  
  82  $graph->Add($p1);
  83  $graph->Stroke();


Generated: Wed Dec 19 21:21:33 2007 Cross-referenced by PHPXref 0.7