ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 20 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 57 of file class.ilChartData.php.

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

◆ getData()

ilChartData::getData ( )

Get data.

Returns
array

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

References $data.

Referenced by parseData().

73  : array
74  {
75  return $this->data;
76  }
+ Here is the caller graph for this function:

◆ getFill()

ilChartData::getFill ( )

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

Referenced by ilChartDataSpider\parseData(), parseData(), and ilChartDataPie\parseGlobalOptions().

88  : array
89  {
90  return array("fill" => $this->fill, "color" => $this->fill_color);
91  }
+ Here is the caller graph for this function:

◆ getLabel()

ilChartData::getLabel ( )

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

References $label.

Referenced by parseData().

46  : string
47  {
48  return $this->label;
49  }
+ Here is the caller graph for this function:

◆ getTypeString()

ilChartData::getTypeString ( )
abstractprotected

Referenced by parseData().

+ Here is the caller graph for this function:

◆ isHidden()

ilChartData::isHidden ( )

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

References $hidden.

Referenced by ilChartDataPie\parseData(), and parseData().

36  : bool
37  {
38  return $this->hidden;
39  }
+ Here is the caller graph for this function:

◆ parseData()

ilChartData::parseData ( array &  $a_data)

Convert data to flot config.

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

References getData(), getFill(), getLabel(), getTypeString(), isHidden(), parseDataOptions(), and ilChart\renderColor().

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

◆ parseDataOptions()

ilChartData::parseDataOptions ( array &  $a_options)
protected

Convert data options to flot config.

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

Referenced by parseData().

96  : void
97  {
98  }
+ Here is the caller graph for this function:

◆ parseGlobalOptions()

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

Convert (global) properties to flot config.

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

137  : void
138  {
139  }

◆ setFill()

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

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

References ilChart\isValidColor().

81  : void {
82  $this->fill = $a_value;
83  if (ilChart::isValidColor($a_color)) {
84  $this->fill_color = $a_color;
85  }
86  }
static isValidColor(string $a_value)
Validate html color code.
+ Here is the call graph for this function:

◆ setHidden()

ilChartData::setHidden ( bool  $a_value)

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

31  : void
32  {
33  $this->hidden = $a_value;
34  }

◆ setLabel()

ilChartData::setLabel ( string  $a_value)

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

41  : void
42  {
43  $this->label = $a_value;
44  }

Field Documentation

◆ $data

array ilChartData::$data = []
protected

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

Referenced by getData().

◆ $fill

float ilChartData::$fill = 0
protected

◆ $fill_color

string ilChartData::$fill_color = ""
protected

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

◆ $hidden

bool ilChartData::$hidden = false
protected

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

Referenced by isHidden().

◆ $label

string ilChartData::$label = ""
protected

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

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

◆ $type

string ilChartData::$type = ""
protected

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


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