]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/PieChartEx.class.php
Initial repo created
[timetracker.git] / WEB-INF / lib / PieChartEx.class.php
diff --git a/WEB-INF/lib/PieChartEx.class.php b/WEB-INF/lib/PieChartEx.class.php
new file mode 100644 (file)
index 0000000..6f482b5
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+  require_once(LIBRARY_DIR.'/libchart/classes/libchart.php');
+
+       /**
+       * Pie chart extension to render pies with no title and labels
+       *
+       * @author   pingw33n
+       */
+
+       class PieChartEx extends PieChart
+       {
+               /**
+               * Render the chart image
+               *
+               * @access       public
+               * @param        array           options: fileName, hideLogo, hideTitle, hidePie, hideLabel
+               */
+
+               public function renderEx($options)
+               {
+                       $hideLabel = isset($options['hideLabel']) && $options['hideLabel'] == true;
+
+                       $this->computePercent();
+
+                       if ($hideLabel) {
+                        $this->plot->setGraphPadding(new Padding(0));
+                        $this->plot->setTitleHeight(0);
+                       }
+                       $this->computeLayout(!$hideLabel);
+
+                       $this->createImage();
+
+                       if (!isset($options['hideLogo']) || $options['hideLogo'] == false)
+                               $this->plot->printLogo();
+                       if (!isset($options['hideTitle']) || $options['hideTitle'] == false)
+                               $this->plot->printTitle();
+                       if (!isset($options['hidePie']) || $options['hidePie'] == false)
+                               $this->printPie();
+                       if (!$hideLabel)
+                               $this->printLabel();
+
+                       /*if(isset($options['fileName']))
+                               imagepng($this->img, $options['fileName']);
+                       else
+                               imagepng($this->img); */
+                       $this->plot->render($options['fileName']);
+               }
+       }
+?>