ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilChartGrid 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 ilChartGrid:
+ Collaboration diagram for ilChartGrid:

Public Member Functions

 getDataInstance (int $a_type=null)
 
 setTicks ($a_x, $a_y, bool $a_labeled=false)
 Set ticks. More...
 
 getTicks ()
 Get ticks. More...
 
 setYAxisToInteger (bool $a_status)
 Restrict y-axis to integer values. More...
 
 setXAxisToInteger (bool $a_status)
 Restrict x-axis to integer values. More...
 
 parseGlobalOptions (stdClass $a_options)
 
- Public Member Functions inherited from ilChart
 getDataInstance (int $a_type=null)
 Get data series instance. More...
 
 setSize (string $a_x, string $a_y)
 Set chart size. More...
 
 addData (ilChartData $a_series, ?int $a_idx=null)
 Add data series. More...
 
 setLegend (ilChartLegend $a_legend)
 
 setColors (array $a_values)
 
 getColors ()
 
 setShadow (int $a_value)
 
 getShadow ()
 
 setAutoResize (bool $a_value)
 Toggle auto-resizing on window resize/redraw. More...
 
 setStacked (bool $a_value)
 
 parseGlobalOptions (stdClass $a_options)
 Convert (global) properties to flot config. More...
 
 getHTML ()
 Render. More...
 

Data Fields

const DATA_LINES = 1
 
const DATA_BARS = 2
 
const DATA_POINTS = 3
 
- Data Fields inherited from ilChart
const TYPE_GRID = 1
 
const TYPE_PIE = 2
 
const TYPE_SPIDER = 3
 

Protected Member Functions

 __construct (string $a_id)
 
 isValidDataType (ilChartData $a_series)
 
- Protected Member Functions inherited from ilChart
 __construct (string $a_id)
 
 isValidDataType (ilChartData $a_series)
 Validate data series. More...
 
 isValid ()
 Basic validation. More...
 
 initJS ()
 Init JS script files. More...
 
 addCustomJS ()
 Add type-specific JS script. More...
 

Protected Attributes

array $ticks
 
array $integer_axis
 
- Protected Attributes inherited from ilChart
ilGlobalTemplateInterface $tpl
 
string $id = ""
 
string $width = ""
 
string $height = ""
 
array $data = []
 
ilChartLegend $legend = null
 
int $shadow = 0
 
array $colors = []
 
bool $auto_resize = false
 
bool $stacked = false
 

Additional Inherited Members

- Static Public Member Functions inherited from ilChart
static getInstanceByType (int $a_type, string $a_id)
 
static isValidColor (string $a_value)
 Validate html color code. More...
 
static renderColor (string $a_value, float $a_opacity=1)
 Render html color code. More...
 

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 Generator for grid-based charts

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.ilChartGrid.php.

Constructor & Destructor Documentation

◆ __construct()

ilChartGrid::__construct ( string  $a_id)
protected

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

References ILIAS\GlobalScreen\Provider\__construct(), setXAxisToInteger(), and setYAxisToInteger().

30  {
31  parent::__construct($a_id);
32 
33  $this->setXAxisToInteger(false);
34  $this->setYAxisToInteger(false);
35  }
setXAxisToInteger(bool $a_status)
Restrict x-axis to integer values.
setYAxisToInteger(bool $a_status)
Restrict y-axis to integer values.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getDataInstance()

ilChartGrid::getDataInstance ( int  $a_type = null)

Definition at line 37 of file class.ilChartGrid.php.

37  : ilChartData
38  {
39  switch ($a_type) {
40  case self::DATA_BARS:
41  return new ilChartDataBars();
42 
43  case self::DATA_POINTS:
44  return new ilChartDataPoints();
45 
46  default:
47  case self::DATA_LINES:
48  return new ilChartDataLines();
49  }
50  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getTicks()

ilChartGrid::getTicks ( )

Get ticks.

Returns
array (x, y)

Definition at line 77 of file class.ilChartGrid.php.

References $ticks.

Referenced by parseGlobalOptions().

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

◆ isValidDataType()

ilChartGrid::isValidDataType ( ilChartData  $a_series)
protected

Definition at line 52 of file class.ilChartGrid.php.

52  : bool
53  {
54  if ($a_series instanceof ilChartDataLines
55  || $a_series instanceof ilChartDataBars
56  || $a_series instanceof ilChartDataPoints) {
57  return true;
58  }
59  return false;
60  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ parseGlobalOptions()

ilChartGrid::parseGlobalOptions ( stdClass  $a_options)

Definition at line 98 of file class.ilChartGrid.php.

References getTicks().

98  : void
99  {
100  // axis/ticks
101  $tmp = array();
102  $ticks = $this->getTicks();
103  if ($ticks) {
104  $labeled = (bool) $ticks["labeled"];
105  unset($ticks["labeled"]);
106  foreach ($ticks as $axis => $def) {
107  if (is_numeric($def) || is_array($def)) {
108  $a_options->{$axis . "axis"} = new stdClass();
109  }
110  if (is_numeric($def)) {
111  $a_options->{$axis . "axis"}->ticks = $def;
112  } elseif (is_array($def)) {
113  $a_options->{$axis . "axis"}->ticks = array();
114  foreach ($def as $idx => $value) {
115  if ($labeled) {
116  $a_options->{$axis . "axis"}->ticks[] = array($idx, $value);
117  } else {
118  $a_options->{$axis . "axis"}->ticks[] = $value;
119  }
120  }
121  }
122  }
123  }
124 
125  // optional: remove decimals
126  if ($this->integer_axis["x"] && !isset($a_options->xaxis)) {
127  $a_options->{"xaxis"} = new stdClass();
128  $a_options->{"xaxis"}->tickDecimals = 0;
129  }
130  if ($this->integer_axis["y"] && !isset($a_options->yaxis)) {
131  $a_options->{"yaxis"} = new stdClass();
132  $a_options->{"yaxis"}->tickDecimals = 0;
133  }
134  }
getTicks()
Get ticks.
+ Here is the call graph for this function:

◆ setTicks()

ilChartGrid::setTicks (   $a_x,
  $a_y,
bool  $a_labeled = false 
)

Set ticks.

Parameters
int | array$a_x
int | array$a_y
bool$a_labeled

Definition at line 68 of file class.ilChartGrid.php.

68  : void
69  {
70  $this->ticks = array("x" => $a_x, "y" => $a_y, "labeled" => $a_labeled);
71  }

◆ setXAxisToInteger()

ilChartGrid::setXAxisToInteger ( bool  $a_status)

Restrict x-axis to integer values.

Definition at line 93 of file class.ilChartGrid.php.

Referenced by __construct().

93  : void
94  {
95  $this->integer_axis["x"] = $a_status;
96  }
+ Here is the caller graph for this function:

◆ setYAxisToInteger()

ilChartGrid::setYAxisToInteger ( bool  $a_status)

Restrict y-axis to integer values.

Definition at line 85 of file class.ilChartGrid.php.

Referenced by __construct().

85  : void
86  {
87  $this->integer_axis["y"] = $a_status;
88  }
+ Here is the caller graph for this function:

Field Documentation

◆ $integer_axis

array ilChartGrid::$integer_axis
protected

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

◆ $ticks

array ilChartGrid::$ticks
protected

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

Referenced by getTicks().

◆ DATA_BARS

◆ DATA_LINES

◆ DATA_POINTS

const ilChartGrid::DATA_POINTS = 3

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


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