ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilChartDataBars.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once "Services/Chart/classes/class.ilChartData.php";
5
14{
15 protected $line_width; // [int]
16 protected $bar_width; // [float] bar
17 protected $bar_align; // [string] bar
18 protected $bar_horizontal; // [bool] bar
19
20 protected function getTypeString()
21 {
22 return "bars";
23 }
24
30 public function setLineWidth($a_value)
31 {
32 $this->line_width = (int) $a_value;
33 }
34
40 public function getLineWidth()
41 {
42 return $this->line_width;
43 }
44
52 public function setBarOptions($a_width, $a_align = "center", $a_horizontal = false)
53 {
54 $this->bar_width = (float) str_replace(",", ".", $a_width);
55 if (in_array((string) $a_align, array("center", "left"))) {
56 $this->bar_align = (string) $a_align;
57 }
58 $this->bar_horizontal = (bool) $a_horizontal;
59 }
60
61 protected function parseDataOptions(array &$a_options)
62 {
63 $width = $this->getLineWidth();
64 if ($width !== null) {
65 $a_options["lineWidth"] = $width;
66 }
67
68 if ($this->bar_width) {
69 $a_options["barWidth"] = $this->bar_width;
70 $a_options["align"] = $this->bar_align;
71 if ($this->bar_horizontal) {
72 $a_options["horizontal"] = true;
73 }
74 }
75 }
76}
An exception for terminatinating execution or to throw for unit testing.
Chart data bars series.
setBarOptions($a_width, $a_align="center", $a_horizontal=false)
Set bar options.
setLineWidth($a_value)
Set line width.
parseDataOptions(array &$a_options)
Convert data options to flot config.
getLineWidth()
Get line width.
getTypeString()
Get series type.
Abstract chart data series base class.