[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (c) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (c) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: bargraph.class.php,v 1.11 2005/07/16 14:26:36 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/bargraph.class.php,v $ 21 */ 22 23 /** 24 \file htdocs/bargraph.class.php 25 \brief Fichier de la classe de gestion de graphs phplot 26 \version $Revision: 1.11 $ 27 */ 28 29 include_once (DOL_DOCUMENT_ROOT."/graph.class.php"); 30 31 32 /** 33 \class BarGraph 34 \brief Classe permettant la gestion des graphs Bar a travers de PHPlot 35 \remarks Usage: 36 $graph_data = array("1"=>10,"2"=>20); 37 $px = new BarGraph(); 38 $px->SetData($graph_data); 39 $px->SetTitle("title"); 40 $px->SetLegend(array("Val1","Val2")); 41 $px->SetWidth(width); 42 $px->SetHeight(height); 43 $px->draw("file.png"); 44 */ 45 46 class BarGraph extends Graph 47 { 48 var $db; 49 var $error; 50 51 52 /** 53 * \brief Initialisation graphe 54 * \return int <0 si ko, >0 si ok 55 */ 56 function BarGraph() 57 { 58 global $conf; 59 60 // Test si module GD présent 61 $modules_list = get_loaded_extensions(); 62 $isgdinstalled=0; 63 foreach ($modules_list as $module) 64 { 65 if ($module == 'gd') { $isgdinstalled=1; } 66 } 67 if (! $isgdinstalled) { 68 $this->error="Erreur: Le module GD pour php ne semble pas disponible. Il est requis pour générer les graphiques."; 69 return -1; 70 } 71 72 // Défini propriétés de l'objet graphe 73 $this->data = $data; // En general data non defini qd on crée objet 74 75 $this->bordercolor = array(235,235,224); 76 $this->datacolor = array(array(204,204,179), array(187,187,136), array(235,235,224)); 77 $this->bgcolor = array(235,235,224); 78 79 $color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php"; 80 if (is_readable($color_file)) 81 { 82 include($color_file); 83 if (isset($theme_bordercolor)) $this->bordercolor = $theme_bordercolor; 84 if (isset($theme_datacolor)) $this->datacolor = $theme_datacolor; 85 if (isset($theme_bgcolor)) $this->bgcolor = $theme_bgcolor; 86 } 87 88 $this->precision_y = 0; 89 90 $this->width = 400; 91 $this->height = 200; 92 93 $this->PlotType = 'bars'; 94 95 return 1; 96 } 97 98 99 function isGraphKo() 100 { 101 return $this->error; 102 } 103 104 } 105 106 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |