[ 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/ -> baracc.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: baracc.class.php,v 1.4 2005/02/18 13:07:03 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/graph/baracc.class.php,v $
  20   *
  21   */
  22  
  23  require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php");
  24  
  25  class GraphBarAcc extends DolibarrGraph {
  26  
  27    Function GraphBarAcc($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, $moys)
  38    {
  39      // Create the graph. These two calls are always required
  40  
  41      $height = 240;
  42      $width = 320;
  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 Graph($width, $height,"auto");    
  51      $graph->SetScale("textlin");
  52  
  53      $graph->yaxis->scale->SetGrace(20);
  54  
  55      $graph->SetFrame($this->showframe);
  56      
  57      // Margins : left, right, top, bottom
  58  
  59      $graph->img->SetMargin(40,20,20,35);
  60      
  61      $b2plot = new BarPlot($datas);
  62  
  63      $b2plot->SetFillColor($this->barcolor);
  64      
  65      $graph->xaxis->scale->SetGrace(20);
  66  
  67      $LabelAngle = 45;
  68      if ($this->LabelAngle <> $LabelAngle && strlen($this->LabelAngle) > 0)
  69        {
  70      $LabelAngle = $this->LabelAngle;
  71        }
  72  
  73      if ($this->LabelAngle > 0)
  74        {
  75      $graph->xaxis->SetLabelAngle($LabelAngle);
  76      $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,7);
  77        }
  78  
  79      
  80      $b1plot = new BarPlot($moys);
  81      $b1plot->SetFillColor("gray");
  82  
  83      // Create the accumulated bar plots
  84      $ab1plot = new AccBarPlot(array($b2plot,$b1plot));
  85  
  86      // ...and add it to the graph
  87      $graph->Add($ab1plot);
  88      
  89  
  90      // Titre
  91  
  92      $graph->title->Set($this->titre);    
  93      $graph->title->SetFont(FF_VERDANA,FS_NORMAL);
  94    
  95      $graph->xaxis->SetTickLabels($labels);
  96  
  97      $graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time()));
  98      
  99      // Display the graph
 100      
 101      $graph->img->SetImgFormat("png");
 102      $graph->Stroke($file);
 103    }
 104  }   
 105  ?>


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