ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilChartData.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
11 abstract class ilChartData
12 {
13  protected $type; // [string]
14  protected $label; // [string]
15  protected $data; // [array]
16  protected $fill; // [float]
17  protected $fill_color; // [color/gradient]
18  protected $hidden; // [bool]
19 
25  abstract protected function getTypeString();
26 
32  public function setHidden($a_value)
33  {
34  $this->hidden = (bool) $a_value;
35  }
36 
42  public function isHidden()
43  {
44  return $this->hidden;
45  }
46 
52  public function setLabel($a_value)
53  {
54  $this->label = (string) $a_value;
55  }
56 
62  public function getLabel()
63  {
64  return $this->label;
65  }
66 
73  public function addPoint($a_x, $a_y = null)
74  {
75  if ($a_y !== null) {
76  $this->data[] = array($a_x, $a_y);
77  } else {
78  $this->data[] = $a_x;
79  }
80  }
81 
87  public function getData()
88  {
89  return $this->data;
90  }
91 
98  public function setFill($a_value, $a_color = null)
99  {
100  $this->fill = $a_value;
101  if (ilChart::isValidColor($a_color)) {
102  $this->fill_color = $a_color;
103  }
104  }
105 
111  public function getFill()
112  {
113  return array("fill"=>$this->fill, "color"=>$this->fill_color);
114  }
115 
122  protected function parseDataOptions(array &$a_options)
123  {
124  }
125 
132  public function parseData(array &$a_data)
133  {
134  $series = new stdClass();
135  $series->label = str_replace("\"", "\\\"", $this->getLabel());
136 
137  $series->data = array();
138  foreach ($this->getData() as $point) {
139  $series->data[] = array($point[0], $point[1]);
140  }
141 
142  $options = array("show"=>($this->isHidden() ? false : true));
143 
144  $fill = $this->getFill();
145  if ($fill["fill"]) {
146  $options["fill"] = $fill["fill"];
147  if ($fill["color"]) {
148  $options["fillColor"] = ilChart::renderColor($fill["color"], $fill["fill"]);
149  }
150  }
151 
152  $this->parseDataOptions($options);
153 
154  $series->{$this->getTypeString()} = $options;
155 
156  $a_data[] = $series;
157  }
158 
165  public function parseGlobalOptions(stdClass $a_options, ilChart $a_chart)
166  {
167  }
168 }
Add some data
Add rich text string
setFill($a_value, $a_color=null)
Set fill.
parseGlobalOptions(stdClass $a_options, ilChart $a_chart)
Convert (global) properties to flot config.
getData()
Get data.
isHidden()
Is hidden?
Abstract Chart generator base class.
addPoint($a_x, $a_y=null)
Set data.
setLabel($a_value)
Set label.
parseData(array &$a_data)
Convert data to flot config.
static isValidColor($a_value)
Validate html color code.
setHidden($a_value)
Set hidden.
getFill()
Get fill.
Create styles array
The data for the language used.
getTypeString()
Get series type.
static renderColor($a_value, $a_opacity=1)
Render html color code.
parseDataOptions(array &$a_options)
Convert data options to flot config.
Abstract chart data series base class.
getLabel()
Get label.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20