From ad926f358376a2b57a8f7d7aad2d61cd03e3ebcb Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 7 Nov 2003 13:32:04 +0000 Subject: [PATCH] =?UTF-8?q?Modif=20pr=E9cision=20sur=20l'axe=20des=20Y,=20?= =?UTF-8?q?reste=20toujours=20le=20probl=E8me=20pour=20les=20nombres=20ent?= =?UTF-8?q?iers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/graph.class.php | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/htdocs/graph.class.php b/htdocs/graph.class.php index 54b5b6ccda7..c53128e1780 100644 --- a/htdocs/graph.class.php +++ b/htdocs/graph.class.php @@ -37,6 +37,9 @@ class Graph $this->precision_y = 0; + $this->width = 400; + $this->height = 200; + return 1; } @@ -45,19 +48,21 @@ class Graph * * */ - Function draw($file, $data) + Function draw($file, $data, $title='') { - $w = 400; - $h = 200; //Define the object - $graph = new PHPlot($w,$h); + $graph = new PHPlot($this->width, $this->height); $graph->SetIsInline(1); + $graph->SetPlotType('bars'); - $graph->SetPlotAreaPixels(60,10,$w-10,$h-30) ; + $graph->SetPlotAreaPixels(60, 10, $this->width-10, $this->height - 30) ; $graph->SetBackgroundColor($this->bgcolor); - $graph->SetPrecisionY($this->precision_Y); + + // TODO + //$graph->SetPrecisionY($this->precision_Y); + $graph->SetDataColors($this->datacolor, $this->bordercolor); $graph->SetOutputFile($file); @@ -67,15 +72,37 @@ class Graph $graph->SetVertTickIncrement(0); + // + if (strlen($title)) + { + $graph->SetTitle = $title; + } + //Draw it $graph->DrawGraph(); } - function SetPrecisionY($which_prec) + Function SetPrecisionY($which_prec) { $this->precision_y = $which_prec; return true; } + + Function SetYLabel($label) + { + $this->YLabel = $label; + } + + Function SetWidth($w) + { + $this->width = $w; + } + + Function SetHeight($h) + { + $this->height = $h; + } + } ?>