ILIAS  release_8 Revision v8.24
ilChartLegend Class Reference

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

+ Collaboration diagram for ilChartLegend:

Public Member Functions

 __construct ()
 
 setPosition (string $a_position)
 
 getPosition ()
 
 setColumns (int $a_value)
 Set number of columns. More...
 
 getColumns ()
 Get number of columns. More...
 
 setMargin (int $a_x, int $a_y)
 
 getMargin ()
 
 setBackground (string $a_color)
 Set background color. More...
 
 getBackground ()
 Get background color. More...
 
 setOpacity (float $a_value)
 
 getOpacity ()
 
 setLabelBorder (string $a_color)
 
 getLabelBorder ()
 
 setContainer (string $a_value)
 Set container id. More...
 
 getContainer ()
 Get container id. More...
 
 parseOptions (stdClass $a_options)
 Convert (global) properties to flot config. More...
 

Protected Attributes

string $position = ""
 
int $columns = 0
 
int $margin_x = 0
 
int $margin_y = 0
 
string $background = ""
 
float $opacity = 0
 
string $border = ""
 
string $container = ""
 

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 Chart legend

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

Constructor & Destructor Documentation

◆ __construct()

ilChartLegend::__construct ( )

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

32 {
33 $this->setPosition("ne");
34 $this->setColumns(1);
35 $this->setMargin(5, 5);
36 $this->setBackground("#888");
37 $this->setOpacity(0.1);
38 $this->setLabelBorder("#bbb");
39 }
setMargin(int $a_x, int $a_y)
setColumns(int $a_value)
Set number of columns.
setBackground(string $a_color)
Set background color.
setOpacity(float $a_value)
setLabelBorder(string $a_color)
setPosition(string $a_position)

References setBackground(), setColumns(), setLabelBorder(), setMargin(), setOpacity(), and setPosition().

+ Here is the call graph for this function:

Member Function Documentation

◆ getBackground()

ilChartLegend::getBackground ( )

Get background color.

Definition at line 94 of file class.ilChartLegend.php.

94 : string
95 {
96 return $this->background;
97 }

References $background.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getColumns()

ilChartLegend::getColumns ( )

Get number of columns.

Definition at line 65 of file class.ilChartLegend.php.

65 : int
66 {
67 return $this->columns;
68 }

References $columns.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getContainer()

ilChartLegend::getContainer ( )

Get container id.

Definition at line 134 of file class.ilChartLegend.php.

134 : string
135 {
136 return $this->container;
137 }

References $container.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getLabelBorder()

ilChartLegend::getLabelBorder ( )

Definition at line 118 of file class.ilChartLegend.php.

118 : string
119 {
120 return $this->border;
121 }

References $border.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getMargin()

ilChartLegend::getMargin ( )

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

76 : array
77 {
78 return array("x" => $this->margin_x, "y" => $this->margin_y);
79 }

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getOpacity()

ilChartLegend::getOpacity ( )

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

106 : float
107 {
108 return $this->opacity;
109 }

References $opacity.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getPosition()

ilChartLegend::getPosition ( )

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

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

References $position.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ parseOptions()

ilChartLegend::parseOptions ( stdClass  $a_options)

Convert (global) properties to flot config.

Definition at line 142 of file class.ilChartLegend.php.

142 : void
143 {
144 $a_options->show = true;
145
146 $a_options->noColumns = $this->getColumns();
147 $a_options->position = $this->getPosition();
148
149 $margin = $this->getMargin();
150 $a_options->margin = array($margin["x"], $margin["y"]);
151
152 $a_options->backgroundColor = ilChart::renderColor($this->getBackground());
153 $a_options->backgroundOpacity = str_replace(",", ".", (string) $this->getOpacity());
154 $a_options->labelBoxBorderColor = ilChart::renderColor($this->getLabelBorder());
155
156 $container = $this->getContainer();
157 if ($container) {
158 $a_options->container = '#' . $container;
159 }
160 }
getColumns()
Get number of columns.
getBackground()
Get background color.
getContainer()
Get container id.
static renderColor(string $a_value, float $a_opacity=1)
Render html color code.

References $container, getBackground(), getColumns(), getContainer(), getLabelBorder(), getMargin(), getOpacity(), getPosition(), and ilChart\renderColor().

+ Here is the call graph for this function:

◆ setBackground()

ilChartLegend::setBackground ( string  $a_color)

Set background color.

Definition at line 84 of file class.ilChartLegend.php.

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

References ilChart\isValidColor().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setColumns()

ilChartLegend::setColumns ( int  $a_value)

Set number of columns.

Definition at line 57 of file class.ilChartLegend.php.

57 : void
58 {
59 $this->columns = $a_value;
60 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setContainer()

ilChartLegend::setContainer ( string  $a_value)

Set container id.

Definition at line 126 of file class.ilChartLegend.php.

126 : void
127 {
128 $this->container = trim($a_value);
129 }

◆ setLabelBorder()

ilChartLegend::setLabelBorder ( string  $a_color)

Definition at line 111 of file class.ilChartLegend.php.

111 : void
112 {
113 if (ilChart::isValidColor($a_color)) {
114 $this->border = $a_color;
115 }
116 }

References ilChart\isValidColor().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMargin()

ilChartLegend::setMargin ( int  $a_x,
int  $a_y 
)

Definition at line 70 of file class.ilChartLegend.php.

70 : void
71 {
72 $this->margin_x = $a_x;
73 $this->margin_y = $a_y;
74 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setOpacity()

ilChartLegend::setOpacity ( float  $a_value)

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

99 : void
100 {
101 if ($a_value >= 0 && $a_value <= 1) {
102 $this->opacity = $a_value;
103 }
104 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setPosition()

ilChartLegend::setPosition ( string  $a_position)

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

41 : void
42 {
43 $all = array("ne", "nw", "se", "sw");
44 if (in_array($a_position, $all)) {
45 $this->position = $a_position;
46 }
47 }

Referenced by __construct(), and ilChartPie\parseGlobalOptions().

+ Here is the caller graph for this function:

Field Documentation

◆ $background

string ilChartLegend::$background = ""
protected

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

Referenced by getBackground().

◆ $border

string ilChartLegend::$border = ""
protected

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

Referenced by getLabelBorder().

◆ $columns

int ilChartLegend::$columns = 0
protected

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

Referenced by getColumns().

◆ $container

string ilChartLegend::$container = ""
protected

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

Referenced by getContainer(), and parseOptions().

◆ $margin_x

int ilChartLegend::$margin_x = 0
protected

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

◆ $margin_y

int ilChartLegend::$margin_y = 0
protected

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

◆ $opacity

float ilChartLegend::$opacity = 0
protected

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

Referenced by getOpacity().

◆ $position

string ilChartLegend::$position = ""
protected

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

Referenced by getPosition().


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