diff --git a/htdocs/dolgraph.class.php b/htdocs/dolgraph.class.php
index be6673090dfee5e4cbf497c7321dea81cc9e4a50..a82eff456e933ea35e292543ea46821dd5ca0ed8 100644
--- a/htdocs/dolgraph.class.php
+++ b/htdocs/dolgraph.class.php
@@ -367,7 +367,7 @@ class DolGraph
 		if ($phplotversion >= 5) $top_space=25;
 		$left_space=80;								// For y labels
 		$right_space=10;							// If no legend
-		if (isset($this->Legend))
+		if (isset($this->Legend) && sizeof($this->Legend))
 		{
 			foreach($this->Legend as $key => $val)
 			{
@@ -390,7 +390,7 @@ class DolGraph
 		if (isset($this->title)) $this->graph->SetTitle($this->title);
 
 		// D�fini position du graphe (et legende) au sein de l'image
-		if (isset($this->Legend))
+		if (isset($this->Legend) && sizeof($this->Legend))
 		{
 			$this->graph->SetLegendPixels($this->width - $right_space+8,40,'');
 			$this->graph->SetLegend($this->Legend);