ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 23 of file class.ilChartLegend.php.

Constructor & Destructor Documentation

◆ __construct()

ilChartLegend::__construct ( )

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

35 {
36 $this->setPosition("ne");
37 $this->setColumns(1);
38 $this->setMargin(5, 5);
39 $this->setBackground("#888");
40 $this->setOpacity(0.1);
41 $this->setLabelBorder("#bbb");
42 }
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 97 of file class.ilChartLegend.php.

97 : string
98 {
99 return $this->background;
100 }

References $background.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getColumns()

ilChartLegend::getColumns ( )

Get number of columns.

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

68 : int
69 {
70 return $this->columns;
71 }

References $columns.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getContainer()

ilChartLegend::getContainer ( )

Get container id.

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

137 : string
138 {
139 return $this->container;
140 }

References $container.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getLabelBorder()

ilChartLegend::getLabelBorder ( )

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

121 : string
122 {
123 return $this->border;
124 }

References $border.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getMargin()

ilChartLegend::getMargin ( )

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

79 : array
80 {
81 return array("x" => $this->margin_x, "y" => $this->margin_y);
82 }

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getOpacity()

ilChartLegend::getOpacity ( )

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

109 : float
110 {
111 return $this->opacity;
112 }

References $opacity.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getPosition()

ilChartLegend::getPosition ( )

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

52 : string
53 {
54 return $this->position;
55 }

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 145 of file class.ilChartLegend.php.

145 : void
146 {
147 $a_options->show = true;
148
149 $a_options->noColumns = $this->getColumns();
150 $a_options->position = $this->getPosition();
151
152 $margin = $this->getMargin();
153 $a_options->margin = array($margin["x"], $margin["y"]);
154
155 $a_options->backgroundColor = ilChart::renderColor($this->getBackground());
156 $a_options->backgroundOpacity = str_replace(",", ".", (string) $this->getOpacity());
157 $a_options->labelBoxBorderColor = ilChart::renderColor($this->getLabelBorder());
158
159 $container = $this->getContainer();
160 if ($container) {
161 $a_options->container = '#' . $container;
162 }
163 }
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 87 of file class.ilChartLegend.php.

87 : void
88 {
89 if (ilChart::isValidColor($a_color)) {
90 $this->background = $a_color;
91 }
92 }
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 60 of file class.ilChartLegend.php.

60 : void
61 {
62 $this->columns = $a_value;
63 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setContainer()

ilChartLegend::setContainer ( string  $a_value)

Set container id.

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

129 : void
130 {
131 $this->container = trim($a_value);
132 }

◆ setLabelBorder()

ilChartLegend::setLabelBorder ( string  $a_color)

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

114 : void
115 {
116 if (ilChart::isValidColor($a_color)) {
117 $this->border = $a_color;
118 }
119 }

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 73 of file class.ilChartLegend.php.

73 : void
74 {
75 $this->margin_x = $a_x;
76 $this->margin_y = $a_y;
77 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setOpacity()

ilChartLegend::setOpacity ( float  $a_value)

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

102 : void
103 {
104 if ($a_value >= 0 && $a_value <= 1) {
105 $this->opacity = $a_value;
106 }
107 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setPosition()

ilChartLegend::setPosition ( string  $a_position)

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

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

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

+ Here is the caller graph for this function:

Field Documentation

◆ $background

string ilChartLegend::$background = ""
protected

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

Referenced by getBackground().

◆ $border

string ilChartLegend::$border = ""
protected

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

Referenced by getLabelBorder().

◆ $columns

int ilChartLegend::$columns = 0
protected

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

Referenced by getColumns().

◆ $container

string ilChartLegend::$container = ""
protected

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

Referenced by getContainer(), and parseOptions().

◆ $margin_x

int ilChartLegend::$margin_x = 0
protected

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

◆ $margin_y

int ilChartLegend::$margin_y = 0
protected

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

◆ $opacity

float ilChartLegend::$opacity = 0
protected

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

Referenced by getOpacity().

◆ $position

string ilChartLegend::$position = ""
protected

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

Referenced by getPosition().


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