[ Index ] |
|
Code source de Dolibarr 2.0.1 |
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: baraccumul.class.php,v 1.4 2005/08/24 08:55:11 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/graph/baraccumul.class.php,v $ 20 * 21 */ 22 23 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php"); 24 25 class GraphBarAccumul extends DolibarrGraph { 26 27 Function GraphBarAccumul($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 $this->datas = array(); 36 37 $this->legend = array(); 38 39 $this->datas_color[0][0] = "green"; 40 $this->datas_color[0][1] = "yellow"; 41 $this->datas_color[0][2] = "blue"; 42 $this->datas_color[0][3] = "pink"; 43 44 $this->datas_color[1][0] = "blue"; 45 $this->datas_color[1][1] = "red"; 46 $this->datas_color[1][2] = "white"; 47 $this->datas_color[1][3] = "pink"; 48 } 49 50 Function add_datas($p_datas) 51 { 52 /* 53 $num = sizeof($this->datas); 54 55 $this->datas[$num] = $p_datas; 56 */ 57 $this->datas = $p_datas; 58 } 59 60 Function GraphDraw($file, $labels, $datas) 61 { 62 // Create the graph. These two calls are always required 63 64 $height = 240; 65 $width = 320; 66 67 if ($this->width <> $width && $this->width > 0) 68 $width = $this->width; 69 70 if ($this->height <> $height && $this->height > 0) 71 $height = $this->height; 72 73 if (sizeof($datas) && sizeof($labels)) 74 { 75 $graph = new Graph($width, $height,"auto"); 76 $graph->SetScale("textlin"); 77 78 $graph->yaxis->scale->SetGrace(20); 79 80 $graph->SetFrame($this->showframe); 81 82 $graph->img->SetMargin(40,20,20,35); 83 84 85 $graph->xaxis->scale->SetGrace(20); 86 87 $LabelAngle = 45; 88 89 if ($this->LabelAngle <> $LabelAngle && strlen($this->LabelAngle) > 0) 90 $LabelAngle = $this->LabelAngle; 91 92 if ($this->LabelAngle > 0) 93 { 94 $graph->xaxis->SetLabelAngle($LabelAngle); 95 $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,7); 96 } 97 98 $graph->title->Set($this->titre); 99 100 $graph->title->SetFont(FF_VERDANA,FS_NORMAL); 101 102 103 $graph->xaxis->SetTickLabels($labels); 104 $graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); 105 106 // 107 108 $gbspl = array(); 109 110 for ($j = 0 ; $j < sizeof($this->datas) ; $j++) 111 { 112 $accs = array(); 113 for ($i = 0 ; $i < sizeof($this->datas[$j]) ; $i++) 114 { 115 $b1plot = new BarPlot($this->datas[$j][$i]); 116 $b1plot->SetFillColor($this->datas_color[$j][$i]); 117 118 $b1plot->SetLegend($this->legend[$j][$i]); 119 120 121 array_push($accs, $b1plot); 122 } 123 124 // Create the accumulated bar plots 125 $ab1plot = new AccBarPlot($accs); 126 127 array_push($gbspl, $ab1plot); 128 } 129 130 $gbplot = new GroupBarPlot ($gbspl); 131 132 133 134 // Adjust the legend position 135 $graph->legend->Pos(0.14,0.14,"left","center"); 136 137 $graph->Add($gbplot); 138 139 // Display the graph 140 141 $graph->img->SetImgFormat("png"); 142 $graph->Stroke($file); 143 } 144 else 145 { 146 // Setup a basic canvas we can work 147 $g = new CanvasGraph($width,$height,'auto'); 148 $g->SetMargin(5,11,6,11); 149 $g->SetShadow(); 150 $g->SetMarginColor("teal"); 151 152 // We need to stroke the plotarea and margin before we add the 153 // text since we otherwise would overwrite the text. 154 //$g->InitFrame(); 155 156 // Draw a text box in the middle 157 $txt = "Données manquantes !"; 158 $t = new Text($txt,ceil($width / 2),ceil($height/2)); 159 $t->SetFont(FF_VERDANA, FS_BOLD, 10); 160 161 // How should the text box interpret the coordinates? 162 $t->Align('center','top'); 163 $t->SetBox("white","black","gray"); 164 $t->ParagraphAlign('center'); 165 166 // Stroke the text 167 $t->Stroke($g->img); 168 169 // Stroke the graph 170 $g->Stroke($file); 171 } 172 } 173 } 174 ?>
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 |
![]() |