From 2d11a73098b106118986d37479d2737646f6512e Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 14 Feb 2005 16:07:31 +0000 Subject: [PATCH] =?UTF-8?q?Am=E9lioration=20g=E9n=E9rale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/telephonie/stats/graph/bar.class.php | 108 ++++++++++---------- 1 file changed, 56 insertions(+), 52 deletions(-) diff --git a/htdocs/telephonie/stats/graph/bar.class.php b/htdocs/telephonie/stats/graph/bar.class.php index a44b67e1a73..92edb2ed981 100644 --- a/htdocs/telephonie/stats/graph/bar.class.php +++ b/htdocs/telephonie/stats/graph/bar.class.php @@ -38,60 +38,64 @@ class GraphBar extends DolibarrGraph { { // Create the graph. These two calls are always required - $height = 240; - $width = 320; - - if ($this->width <> $width && $this->width > 0) - $width = $this->width; - - if ($this->height <> $height && $this->height > 0) - $height = $this->height; - - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - - $graph->yaxis->scale->SetGrace(20); - - $graph->SetFrame($this->showframe); - - $graph->img->SetMargin(40,20,20,40); - - if ($this->type == 'LinePlot') + if (sizeof($datas) && sizeof($labels)) { - $b2plot = new LinePlot($datas); + + $height = 240; + $width = 320; + + if ($this->width <> $width && $this->width > 0) + $width = $this->width; + + if ($this->height <> $height && $this->height > 0) + $height = $this->height; + + $graph = new Graph($width, $height,"auto"); + $graph->SetScale("textlin"); + + $graph->yaxis->scale->SetGrace(20); + + $graph->SetFrame($this->showframe); + + $graph->img->SetMargin(40,20,20,40); + + if ($this->type == 'LinePlot') + { + $b2plot = new LinePlot($datas); + } + else + { + $b2plot = new BarPlot($datas); + } + + $b2plot->SetFillColor($this->barcolor); + + $graph->xaxis->scale->SetGrace(20); + + $LabelAngle = 45; + if ($this->LabelAngle <> $LabelAngle && $this->LabelAngle > 0) + $LabelAngle = $this->LabelAngle; + + $graph->xaxis->SetLabelAngle($LabelAngle); + + $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,8); + + $graph->Add($b2plot); + + $graph->title->Set($this->titre); + + $graph->title->SetFont(FF_VERDANA,FS_NORMAL); + + $graph->yaxis->title->SetFont(FF_FONT2); + $graph->xaxis->title->SetFont(FF_FONT1); + + $graph->xaxis->SetTickLabels($labels); + + // Display the graph + + $graph->img->SetImgFormat("png"); + $graph->Stroke($file); } - else - { - $b2plot = new BarPlot($datas); - } - - $b2plot->SetFillColor($this->barcolor); - - $graph->xaxis->scale->SetGrace(20); - - $LabelAngle = 45; - if ($this->LabelAngle <> $LabelAngle && $this->LabelAngle > 0) - $LabelAngle = $this->LabelAngle; - - $graph->xaxis->SetLabelAngle($LabelAngle); - - $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,8); - - $graph->Add($b2plot); - - $graph->title->Set($this->titre); - - $graph->title->SetFont(FF_VERDANA,FS_NORMAL); - - $graph->yaxis->title->SetFont(FF_FONT2); - $graph->xaxis->title->SetFont(FF_FONT1); - - $graph->xaxis->SetTickLabels($labels); - - // Display the graph - - $graph->img->SetImgFormat("png"); - $graph->Stroke($file); } } ?>