posaune
[timetracker.git] / WEB-INF / lib / PieChartEx.class.php
1 <?php
2   require_once(LIBRARY_DIR.'/libchart/classes/libchart.php');
3
4         /**
5         * Pie chart extension to render pies with no title and labels
6         *
7         * @author   pingw33n
8         */
9
10         class PieChartEx extends PieChart
11         {
12                 /**
13                 * Render the chart image
14                 *
15                 * @access       public
16                 * @param        array           options: fileName, hideLogo, hideTitle, hidePie, hideLabel
17                 */
18
19                 public function renderEx($options)
20                 {
21                         $hideLabel = isset($options['hideLabel']) && $options['hideLabel'] == true;
22
23                         $this->computePercent();
24
25                         if ($hideLabel) {
26                          $this->plot->setGraphPadding(new Padding(0));
27                          $this->plot->setTitleHeight(0);
28                         }
29                         $this->computeLayout(!$hideLabel);
30
31                         $this->createImage();
32
33                         if (!isset($options['hideLogo']) || $options['hideLogo'] == false)
34                                 $this->plot->printLogo();
35                         if (!isset($options['hideTitle']) || $options['hideTitle'] == false)
36                                 $this->plot->printTitle();
37                         if (!isset($options['hidePie']) || $options['hidePie'] == false)
38                                 $this->printPie();
39                         if (!$hideLabel)
40                                 $this->printLabel();
41
42                         /*if(isset($options['fileName']))
43                                 imagepng($this->img, $options['fileName']);
44                         else
45                                 imagepng($this->img); */
46                         $this->plot->render($options['fileName']);
47                 }
48         }
49