ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 23 of file class.ilChartGrid.php.

Constructor & Destructor Documentation

◆ __construct()

ilChartGrid::__construct ( string  $a_id)
protected

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

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

33  {
34  parent::__construct($a_id);
35 
36  $this->setXAxisToInteger(false);
37  $this->setYAxisToInteger(false);
38  }
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 40 of file class.ilChartGrid.php.

40  : ilChartData
41  {
42  switch ($a_type) {
43  case self::DATA_BARS:
44  return new ilChartDataBars();
45 
46  case self::DATA_POINTS:
47  return new ilChartDataPoints();
48 
49  default:
50  case self::DATA_LINES:
51  return new ilChartDataLines();
52  }
53  }
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 80 of file class.ilChartGrid.php.

References $ticks.

Referenced by parseGlobalOptions().

80  : array
81  {
82  return $this->ticks;
83  }
+ Here is the caller graph for this function:

◆ isValidDataType()

ilChartGrid::isValidDataType ( ilChartData  $a_series)
protected

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

55  : bool
56  {
57  if ($a_series instanceof ilChartDataLines
58  || $a_series instanceof ilChartDataBars
59  || $a_series instanceof ilChartDataPoints) {
60  return true;
61  }
62  return false;
63  }
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 101 of file class.ilChartGrid.php.

References getTicks().

101  : void
102  {
103  // axis/ticks
104  $tmp = array();
105  $ticks = $this->getTicks();
106  if ($ticks) {
107  $labeled = (bool) $ticks["labeled"];
108  unset($ticks["labeled"]);
109  foreach ($ticks as $axis => $def) {
110  if (is_numeric($def) || is_array($def)) {
111  $a_options->{$axis . "axis"} = new stdClass();
112  }
113  if (is_numeric($def)) {
114  $a_options->{$axis . "axis"}->ticks = $def;
115  } elseif (is_array($def)) {
116  $a_options->{$axis . "axis"}->ticks = array();
117  foreach ($def as $idx => $value) {
118  if ($labeled) {
119  $a_options->{$axis . "axis"}->ticks[] = array($idx, $value);
120  } else {
121  $a_options->{$axis . "axis"}->ticks[] = $value;
122  }
123  }
124  }
125  }
126  }
127 
128  // optional: remove decimals
129  if ($this->integer_axis["x"] && !isset($a_options->xaxis)) {
130  $a_options->{"xaxis"} = new stdClass();
131  $a_options->{"xaxis"}->tickDecimals = 0;
132  }
133  if ($this->integer_axis["y"] && !isset($a_options->yaxis)) {
134  $a_options->{"yaxis"} = new stdClass();
135  $a_options->{"yaxis"}->tickDecimals = 0;
136  }
137  }
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 71 of file class.ilChartGrid.php.

71  : void
72  {
73  $this->ticks = array("x" => $a_x, "y" => $a_y, "labeled" => $a_labeled);
74  }

◆ setXAxisToInteger()

ilChartGrid::setXAxisToInteger ( bool  $a_status)

Restrict x-axis to integer values.

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

Referenced by __construct().

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

◆ setYAxisToInteger()

ilChartGrid::setYAxisToInteger ( bool  $a_status)

Restrict y-axis to integer values.

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

Referenced by __construct().

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

Field Documentation

◆ $integer_axis

array ilChartGrid::$integer_axis
protected

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

◆ $ticks

array ilChartGrid::$ticks
protected

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

Referenced by getTicks().

◆ DATA_BARS

◆ DATA_LINES

◆ DATA_POINTS

const ilChartGrid::DATA_POINTS = 3

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


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