ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 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.

References null.

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

◆ getData()

ilChartData::getData ( )

Get data.

Returns
array

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

References $data.

Referenced by parseData().

76  : array
77  {
78  return $this->data;
79  }
+ Here is the caller graph for this function:

◆ getFill()

ilChartData::getFill ( )

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

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

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

◆ getLabel()

ilChartData::getLabel ( )

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

References $label.

Referenced by parseData().

49  : string
50  {
51  return $this->label;
52  }
+ 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 39 of file class.ilChartData.php.

References $hidden.

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

39  : bool
40  {
41  return $this->hidden;
42  }
+ Here is the caller graph for this function:

◆ parseData()

ilChartData::parseData ( array &  $a_data)

Convert data to flot config.

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

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

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  }
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 99 of file class.ilChartData.php.

Referenced by parseData().

99  : void
100  {
101  }
+ 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 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.

References ilChart\isValidColor().

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.
+ Here is the call graph for this function:

◆ 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.

Referenced by getData().

◆ $fill

float ilChartData::$fill = 0
protected

◆ $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: