4 include_once
"Services/Chart/classes/class.ilChartLegend.php";
54 include_once
"Services/Chart/classes/class.ilChartGrid.php";
58 include_once
"Services/Chart/classes/class.ilChartPie.php";
61 case self::TYPE_SPIDER:
62 include_once
"Services/Chart/classes/class.ilChartSpider.php";
88 if(
sizeof($this->
data))
104 $this->height = $a_y;
122 $this->
data[$a_idx] = $a_series;
134 $this->legend = $a_legend;
144 foreach($a_values as $color)
146 if(self::isValidColor($color))
148 $this->colors[] = $color;
171 if(preg_match(
"/^#[0-9a-f]{3}$/i", $a_value, $match))
175 else if(preg_match(
"/^#[0-9a-f]{6}$/i", $a_value, $match))
190 if(self::isValidColor($a_value))
192 if(strlen($a_value) == 4)
194 return "rgba(".hexdec($a_value[1].$a_value[1]).
", ".
195 hexdec($a_value[2].$a_value[2]).
", ".
196 hexdec($a_value[3].$a_value[3]).
", ".$a_opacity.
")";
200 return "rgba(".hexdec($a_value[1].$a_value[2]).
", ".
201 hexdec($a_value[3].$a_value[4]).
", ".
202 hexdec($a_value[5].$a_value[6]).
", ".$a_opacity.
")";
214 $this->shadow = (int)$a_value;
234 $this->auto_resize = (bool)$a_value;
244 $this->stacked = (bool)$a_value;
254 include_once
"Services/jQuery/classes/class.iljQueryUtil.php";
257 $tpl->addJavascript(
"Services/Chart/js/flot/excanvas.min.js");
258 $tpl->addJavascript(
"Services/Chart/js/flot/jquery.flot.min.js");
260 if((
bool)$this->auto_resize)
263 $tpl->addJavascript(
"Services/Chart/js/flot/jquery.flot.resize.min.js");
266 if((
bool)$this->stacked)
268 $tpl->addJavascript(
"Services/Chart/js/flot/jquery.flot.stack.min.js");
305 $chart->setVariable(
"ID", $this->
id);
309 if(is_numeric($this->width))
311 $chart->setVariable(
"WIDTH",
"width:".$this->width.
"px;");
315 $chart->setVariable(
"WIDTH",
"width:".$this->width.
";");
320 if(is_numeric($this->height))
322 $chart->setVariable(
"HEIGHT",
"height:".$this->height.
"px;");
326 $chart->setVariable(
"HEIGHT",
"height:".$this->height.
";");
333 $json_series =
array();
336 $series->parseData($json_series);
338 $chart->setVariable(
"SERIES", json_encode($json_series));
343 $json_options =
new stdClass();
344 $json_options->series =
new stdClass();
345 $json_options->series->shadowSize = (int)$this->
getShadow();
346 $json_options->series->lines =
new stdClass();
347 $json_options->series->lines->show =
false;
348 $json_options->series->stack = (bool)$this->stacked;
350 foreach($this->
data as $series)
352 $series->parseGlobalOptions($json_options, $this);
360 $json_options->colors =
array();
363 $json_options->colors[] = self::renderColor($color);
368 $json_options->legend =
new stdClass();
371 $json_options->legend->show =
false;
375 $this->legend->parseOptions($json_options->legend);
378 $chart->setVariable(
"OPTIONS", json_encode($json_options));
setSize($a_x, $a_y)
Set chart size.
setStacked($a_value)
Toggle stacking.
parseGlobalOptions(stdClass $a_options)
Convert (global) properties to flot config.
addCustomJS()
Add type-specific JS script.
Generator for spider charts.
__construct($a_id)
Constructor.
setShadow($a_value)
Set shadow.
isValidDataType(ilChartData $a_series)
Validate data series.
Abstract Chart generator base class.
setLegend(ilChartLegend $a_legend)
Set chart legend.
initJS()
Init JS script files.
isValid()
Basic validation.
setAutoResize($a_value)
Toggle auto-resizing on window resize/redraw.
static isValidColor($a_value)
Validate html color code.
special template class to simplify handling of ITX/PEAR
Generator for pie charts.
Create styles array
The data for the language used.
static renderColor($a_value, $a_opacity=1)
Render html color code.
Generator for grid-based charts.
setColors($a_values)
Set colors.
static initjQuery($a_tpl=null)
Init jQuery.
Abstract chart data series base class.
getDataInstance($a_type=null)
Get data series instance.
addData(ilChartData $a_series, $a_idx=null)
Add data series.
static getInstanceByType($a_type, $a_id)
Get type instance.