[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/telephonie/stats/graph/ -> pie.class.php (source)

   1  <?PHP
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: pie.class.php,v 1.3 2005/03/14 11:42:22 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/graph/pie.class.php,v $
  20   *
  21   */
  22  
  23  require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php");
  24  
  25  class GraphPie extends DolibarrGraph {
  26  
  27    Function GraphPie($DB, $file)
  28    {
  29      $this->db = $DB;
  30      $this->file = $file;
  31      $this->bgcolor = "#DEE7EC";
  32      $this->barcolor = "green";
  33      $this->client = 0;
  34      $this->showframe = true;
  35    }
  36    
  37    Function GraphDraw($file, $datas, $labels)
  38    {
  39      // Create the graph. These two calls are always required
  40  
  41      $height = 240;
  42      $width = 400;
  43  
  44      if ($this->width <> $width && $this->width > 0)
  45        $width = $this->width;
  46  
  47      if ($this->height <> $height && $this->height > 0)
  48        $height = $this->height;
  49  
  50      $graph = new PieGraph($width, $height,"auto");    
  51  
  52      $graph->SetColor("gray") ;
  53  
  54      // Create the bar plots
  55      
  56      $pieplot = new PiePlot($datas);
  57      
  58      $pieplot->SetCenter(0.30,0.53);
  59      
  60      // Label font and color setup
  61      $pieplot->SetFont(FF_FONT1,FS_BOLD);
  62      $pieplot->SetFontColor("darkred");
  63      
  64      if (is_array($this->colors))
  65        {
  66      $pieplot->SetSliceColors($this->colors);
  67        }
  68  
  69      // Size of pie in fraction of the width of the graph
  70      $pieplot->SetSize(0.38);
  71      
  72      // Legends
  73      $pieplot->SetLegends($labels);
  74      $graph->legend->Pos(0.04,0.15);
  75      
  76      $graph->Add($pieplot);
  77      
  78      $graph->title->Set($this->titre);
  79      
  80      $graph->title->SetFont(FF_FONT1,FS_BOLD);
  81      
  82      
  83      // Display the graph
  84      
  85      $graph->img->SetImgFormat("png");
  86  
  87      if (sizeof($datas) > 0)
  88        {
  89      $graph->Stroke($file);
  90        }
  91    }
  92  }   
  93  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics