ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilChartData Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilChartData:
+ Collaboration diagram for ilChartData:

Public Member Functions

 setHidden (bool $a_value)
 
 isHidden ()
 
 setLabel (string $a_value)
 
 getLabel ()
 
 addPoint (float $a_x, ?float $a_y=null)
 Set data. More...
 
 getData ()
 Get data. More...
 
 setFill (float $a_value, string $a_color="")
 
 getFill ()
 
 parseData (array &$a_data)
 Convert data to flot config. More...
 
 parseGlobalOptions (stdClass $a_options, ilChart $a_chart)
 Convert (global) properties to flot config. More...
 

Protected Member Functions

 getTypeString ()
 
 parseDataOptions (array &$a_options)
 Convert data options to flot config. More...
 

Protected Attributes

string $type = ""
 
string $label = ""
 
array $data = []
 
float $fill = 0
 
string $fill_color = ""
 
bool $hidden = false
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Abstract chart data series base class

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 23 of file class.ilChartData.php.

Member Function Documentation

◆ addPoint()

ilChartData::addPoint ( float  $a_x,
?float  $a_y = null 
)

Set data.

Parameters
float$a_x
float$a_y

Definition at line 60 of file class.ilChartData.php.

63 : void {
64 if ($a_y !== null) {
65 $this->data[] = array($a_x, $a_y);
66 } else {
67 $this->data[] = $a_x;
68 }
69 }

◆ getData()

ilChartData::getData ( )

Get data.

Returns
array

Definition at line 76 of file class.ilChartData.php.

76 : array
77 {
78 return $this->data;
79 }

References $data.

◆ getFill()

ilChartData::getFill ( )

Definition at line 91 of file class.ilChartData.php.

91 : array
92 {
93 return array("fill" => $this->fill, "color" => $this->fill_color);
94 }

Referenced by ilChartDataSpider\parseData().

+ Here is the caller graph for this function:

◆ getLabel()

ilChartData::getLabel ( )

Definition at line 49 of file class.ilChartData.php.

49 : string
50 {
51 return $this->label;
52 }

References $label.

◆ getTypeString()

ilChartData::getTypeString ( )
abstractprotected

◆ isHidden()

ilChartData::isHidden ( )

Definition at line 39 of file class.ilChartData.php.

39 : bool
40 {
41 return $this->hidden;
42 }

References $hidden.

Referenced by ilChartDataPie\parseData().

+ Here is the caller graph for this function:

◆ parseData()

ilChartData::parseData ( array &  $a_data)

Convert data to flot config.

Reimplemented in ilChartDataPie, and ilChartDataSpider.

Definition at line 106 of file class.ilChartData.php.

106 : void
107 {
108 $series = new stdClass();
109 $series->label = str_replace("\"", "\\\"", $this->getLabel());
110
111 $series->data = array();
112 foreach ($this->getData() as $point) {
113 if (is_array($point)) {
114 $series->data[] = array($point[0], $point[1]);
115 } else {
116 $series->data[] = $point;
117 }
118 }
119
120 $options = array("show" => !$this->isHidden());
121
122 $fill = $this->getFill();
123 if ($fill["fill"]) {
124 $options["fill"] = $fill["fill"];
125 if ($fill["color"]) {
126 $options["fillColor"] = ilChart::renderColor($fill["color"], $fill["fill"]);
127 }
128 }
129
130 $this->parseDataOptions($options);
131
132 $series->{$this->getTypeString()} = $options;
133
134 $a_data[] = $series;
135 }
parseDataOptions(array &$a_options)
Convert data options to flot config.
getData()
Get data.
static renderColor(string $a_value, float $a_opacity=1)
Render html color code.

References ILIAS\Test\Questions\Presentation\getLabel, and ilChart\renderColor().

+ Here is the call graph for this function:

◆ parseDataOptions()

ilChartData::parseDataOptions ( array &  $a_options)
protected

Convert data options to flot config.

Reimplemented in ilChartDataBars, ilChartDataLines, and ilChartDataPoints.

Definition at line 99 of file class.ilChartData.php.

99 : void
100 {
101 }

◆ parseGlobalOptions()

ilChartData::parseGlobalOptions ( stdClass  $a_options,
ilChart  $a_chart 
)

Convert (global) properties to flot config.

Reimplemented in ilChartDataPie, and ilChartDataSpider.

Definition at line 140 of file class.ilChartData.php.

140 : void
141 {
142 }

◆ setFill()

ilChartData::setFill ( float  $a_value,
string  $a_color = "" 
)

Definition at line 81 of file class.ilChartData.php.

84 : void {
85 $this->fill = $a_value;
86 if (ilChart::isValidColor($a_color)) {
87 $this->fill_color = $a_color;
88 }
89 }
static isValidColor(string $a_value)
Validate html color code.

◆ setHidden()

ilChartData::setHidden ( bool  $a_value)

Definition at line 34 of file class.ilChartData.php.

34 : void
35 {
36 $this->hidden = $a_value;
37 }

◆ setLabel()

ilChartData::setLabel ( string  $a_value)

Definition at line 44 of file class.ilChartData.php.

44 : void
45 {
46 $this->label = $a_value;
47 }

Field Documentation

◆ $data

array ilChartData::$data = []
protected

Definition at line 27 of file class.ilChartData.php.

◆ $fill

float ilChartData::$fill = 0
protected

Definition at line 28 of file class.ilChartData.php.

Referenced by ilChartDataSpider\parseData().

◆ $fill_color

string ilChartData::$fill_color = ""
protected

Definition at line 29 of file class.ilChartData.php.

◆ $hidden

bool ilChartData::$hidden = false
protected

Definition at line 30 of file class.ilChartData.php.

Referenced by isHidden().

◆ $label

string ilChartData::$label = ""
protected

Definition at line 26 of file class.ilChartData.php.

Referenced by getLabel(), and ilChartDataSpider\parseGlobalOptions().

◆ $type

string ilChartData::$type = ""
protected

Definition at line 25 of file class.ilChartData.php.


The documentation for this class was generated from the following file: