[ 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/ -> line.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: line.class.php,v 1.3 2005/02/22 08:27:01 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/graph/line.class.php,v $
  20   *
  21   */
  22  
  23  require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php");
  24  
  25  class GraphLine extends DolibarrGraph {
  26  
  27    Function GraphLine($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 Graph($width, $height,"auto");    
  51      $graph->SetScale("textlin");
  52  
  53      $graph->yaxis->scale->SetGrace(20);
  54  
  55      $graph->SetFrame($this->showframe);
  56      
  57      $graph->img->SetMargin(40,20,20,40);
  58      
  59      $b2plot = new LinePlot($datas);
  60  
  61      $b2plot->SetFillColor($this->barcolor);
  62      
  63      $graph->xaxis->scale->SetGrace(20);
  64      
  65      $graph->yaxis->scale->SetAutoMin(0);
  66  
  67  
  68      $LabelAngle = 45;
  69      if ($this->LabelAngle <> $LabelAngle && $this->LabelAngle > 0)
  70        $LabelAngle = $this->LabelAngle;
  71  
  72      $graph->xaxis->SetLabelAngle($LabelAngle);
  73  
  74      $graph->xaxis->SetTextLabelInterval($this->LabelInterval);
  75   
  76      $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,8);
  77      
  78      $graph->Add($b2plot);
  79      
  80      $graph->title->Set($this->titre);
  81      
  82      $graph->title->SetFont(FF_VERDANA,FS_NORMAL);
  83  
  84      $graph->yaxis->title->SetFont(FF_FONT2);
  85      $graph->xaxis->title->SetFont(FF_FONT1);
  86      
  87      $graph->xaxis->SetTickLabels($labels);
  88      
  89      // Display the graph
  90      
  91      $graph->img->SetImgFormat("png");
  92  
  93      if (sizeof($datas) > 0)
  94        {
  95      $graph->Stroke($file);
  96        }
  97    }
  98  }   
  99  ?>


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