From 1ac7c1aca66c6b4c5e9d006f6a5deeafa1d14604 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 14 Feb 2005 16:19:33 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20g=E9n=E9ration=20d'une=20image=20avec?= =?UTF-8?q?=20message=20lorsque=20le=20graph=20ne=20peut=20=EAtre=20g=E9n?= =?UTF-8?q?=E9r=E9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/telephonie/stats/graph/bar.class.php | 47 ++++++++++++++++----- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/htdocs/telephonie/stats/graph/bar.class.php b/htdocs/telephonie/stats/graph/bar.class.php index 92edb2ed981..72341b3d434 100644 --- a/htdocs/telephonie/stats/graph/bar.class.php +++ b/htdocs/telephonie/stats/graph/bar.class.php @@ -38,18 +38,17 @@ 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; + if (sizeof($datas) && sizeof($labels)) { - - $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"); @@ -96,6 +95,34 @@ class GraphBar extends DolibarrGraph { $graph->img->SetImgFormat("png"); $graph->Stroke($file); } + else + { + // Setup a basic canvas we can work + $g = new CanvasGraph($width,$height,'auto'); + $g->SetMargin(5,11,6,11); + $g->SetShadow(); + $g->SetMarginColor("teal"); + + // We need to stroke the plotarea and margin before we add the + // text since we otherwise would overwrite the text. + //$g->InitFrame(); + + // Draw a text box in the middle + $txt = "Données manquantes !"; + $t = new Text($txt,ceil($width / 2),ceil($height/2)); + $t->SetFont(FF_VERDANA, FS_BOLD, 10); + + // How should the text box interpret the coordinates? + $t->Align('center','top'); + $t->SetBox("white","black","gray"); + $t->ParagraphAlign('center'); + + // Stroke the text + $t->Stroke($g->img); + + // Stroke the graph + $g->Stroke($file); + } } } ?>