From: Ben Klang Date: Tue, 8 Jul 2008 14:26:12 +0000 (+0000) Subject: Format numbers on the graph selectively X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9233fe97b562ab093f4c3797238348cfcaf16fac;p=horde.git Format numbers on the graph selectively --- diff --git a/graphgen.php b/graphgen.php index 46f44d1b9..0ef99c59d 100644 --- a/graphgen.php +++ b/graphgen.php @@ -1,6 +1,6 @@ * @@ -17,7 +17,7 @@ require_once OPERATOR_BASE . '/lib/base.php'; require_once 'Image/Graph.php'; $graphtype = Util::getFormData('graph'); -$graphInfo = Operator::getGraphInfo($graphtype); +$graphinfo = Operator::getGraphInfo($graphtype); $cachekey = Util::getFormData('key'); $stats = unserialize($cache->get($cachekey, 0)); @@ -42,7 +42,7 @@ if (!empty($conf['ttf_font'])) { // create the plotarea layout $graph->add( Image_Graph::vertical( - Image_Graph::factory('title', array($graphInfo['title'], 11)), + Image_Graph::factory('title', array($graphinfo['title'], 11)), #Image_Graph::vertical( $plotarea = Image_Graph::factory('plotarea'), # $legend = Image_Graph::factory('legend'), @@ -86,7 +86,9 @@ $marker->setFillColor(false); // and use the marker on the 1st plot $plot1->setMarker($PointingMarker); -$marker->setDataPreProcessor(Image_Graph::factory('Image_Graph_DataPreProcessor_Formatted', '%0.1f')); +if (!empty($graphinfo['numberformat'])) { + $marker->setDataPreProcessor(Image_Graph::factory('Image_Graph_DataPreProcessor_Formatted', $graphinfo['numberformat'])); +} $marker->setFontSize(6.5); // create an area plot using a random dataset @@ -102,9 +104,9 @@ $marker->setFontSize(6.5); #$plot2->setTitle('Secondary Axis'); $axisX =& $plotarea->getAxis(IMAGE_GRAPH_AXIS_X); -$axisX->setTitle($graphInfo['axisX']); +$axisX->setTitle($graphinfo['axisX']); $axisY =& $plotarea->getAxis(IMAGE_GRAPH_AXIS_Y); -$axisY->setTitle($graphInfo['axisY'], 'vertical'); +$axisY->setTitle($graphinfo['axisY'], 'vertical'); #$axisYsecondary =& $plotarea->getAxis(IMAGE_GRAPH_AXIS_Y_SECONDARY); #$axisYsecondary->setTitle('Pears', 'vertical2'); diff --git a/lib/Operator.php b/lib/Operator.php index 7ec58d3b4..b9e5dc3fc 100644 --- a/lib/Operator.php +++ b/lib/Operator.php @@ -2,7 +2,7 @@ /** * Operator Base Class. * - * $Horde: incubator/operator/lib/Operator.php,v 1.9 2008/07/06 18:21:50 bklang Exp $ + * $Horde: incubator/operator/lib/Operator.php,v 1.10 2008/07/08 14:26:12 bklang Exp $ * * Copyright 2008 The Horde Project * @@ -147,6 +147,7 @@ class Operator { 'title' => _("Total Minutes Used by Month"), 'axisX' => _("Month"), 'axisY' => _("Minute"), + 'numberformat' => '%0.1f', ); break; case 'failed':