4 include_once
"Services/Chart/classes/class.ilChartLegend.php";
36 $this->data = array();
53 include_once
"Services/Chart/classes/class.ilChartGrid.php";
57 include_once
"Services/Chart/classes/class.ilChartPie.php";
60 case self::TYPE_SPIDER:
61 include_once
"Services/Chart/classes/class.ilChartSpider.php";
87 if(
sizeof($this->data))
103 $this->height = $a_y;
121 $this->data[$a_idx] = $a_series;
133 $this->legend = $a_legend;
143 foreach($a_values as $color)
145 if(self::isValidColor($color))
147 $this->colors[] = $color;
170 if(preg_match(
"/^#[0-9a-f]{3}$/i", $a_value, $match))
174 else if(preg_match(
"/^#[0-9a-f]{6}$/i", $a_value, $match))
189 if(self::isValidColor($a_value))
191 if(strlen($a_value) == 4)
193 return "rgba(".hexdec($a_value[1].$a_value[1]).
", ".
194 hexdec($a_value[2].$a_value[2]).
", ".
195 hexdec($a_value[3].$a_value[3]).
", ".$a_opacity.
")";
199 return "rgba(".hexdec($a_value[1].$a_value[2]).
", ".
200 hexdec($a_value[3].$a_value[4]).
", ".
201 hexdec($a_value[5].$a_value[6]).
", ".$a_opacity.
")";
213 $this->shadow = (int)$a_value;
233 $this->auto_resize = (bool)$a_value;
243 include_once
"Services/jQuery/classes/class.iljQueryUtil.php";
246 $tpl->addJavascript(
"Services/Chart/js/flot/excanvas.min.js");
247 $tpl->addJavascript(
"Services/Chart/js/flot/jquery.flot.min.js");
249 if((
bool)$this->auto_resize)
252 $tpl->addJavascript(
"Services/Chart/js/flot/jquery.flot.resize.min.js");
288 $chart =
new ilTemplate(
"tpl.grid.html",
true,
true,
"Services/Chart");
289 $chart->setVariable(
"ID", $this->
id);
293 if(is_numeric($this->width))
295 $chart->setVariable(
"WIDTH",
"width:".$this->width.
"px;");
299 $chart->setVariable(
"WIDTH",
"width:".$this->width.
";");
304 if(is_numeric($this->height))
306 $chart->setVariable(
"HEIGHT",
"height:".$this->height.
"px;");
310 $chart->setVariable(
"HEIGHT",
"height:".$this->height.
";");
317 $json_series = array();
318 foreach($this->data as $series)
320 $series->parseData($json_series);
322 $chart->setVariable(
"SERIES", json_encode($json_series));
327 $json_options =
new stdClass();
328 $json_options->series =
new stdClass();
329 $json_options->series->shadowSize = (int)$this->
getShadow();
330 $json_options->series->lines =
new stdClass();
331 $json_options->series->lines->show =
false;
333 foreach($this->data as $series)
335 $series->parseGlobalOptions($json_options, $this);
343 $json_options->colors = array();
351 $json_options->legend =
new stdClass();
354 $json_options->legend->show =
false;
358 $this->legend->parseOptions($json_options->legend);
361 $chart->setVariable(
"OPTIONS", json_encode($json_options));
363 $ret = $chart->get();