ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilChartLegend Class Reference

Chart legend. More...

+ Collaboration diagram for ilChartLegend:

Public Member Functions

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

Protected Attributes

 $position
 
 $columns
 
 $margin_x
 
 $margin_y
 
 $background
 
 $opacity
 
 $border
 
 $container
 

Detailed Description

Chart legend.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilChartLegend::__construct ( )

Constructor.

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

26 {
27 $this->setPosition("ne");
28 $this->setColumns(1);
29 $this->setMargin(5, 5);
30 $this->setBackground("#888");
31 $this->setOpacity(0.1);
32 $this->setLabelBorder("#bbb");
33 }
setColumns($a_value)
Set number of columns.
setMargin($a_x, $a_y)
Set margins.
setLabelBorder($a_color)
Set label border.
setOpacity($a_value)
Set Opacity.
setPosition($a_position)
Set Position.
setBackground($a_color)
Set background color.

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.

Returns
string

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

120 {
121 return $this->background;
122 }

References $background.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getColumns()

ilChartLegend::getColumns ( )

Get number of columns.

Returns
int

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

75 {
76 return $this->columns;
77 }

References $columns.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getContainer()

ilChartLegend::getContainer ( )

Get container id.

Returns
string

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

187 {
188 return $this->container;
189 }

References $container.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getLabelBorder()

ilChartLegend::getLabelBorder ( )

Get label border.

Returns
string

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

167 {
168 return $this->border;
169 }

References $border.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getMargin()

ilChartLegend::getMargin ( )

Get margins.

Returns
array (x, y)

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

97 {
98 return array("x"=>$this->margin_x, "y"=>$this->margin_y);
99 }

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getOpacity()

ilChartLegend::getOpacity ( )

Get opacity.

Returns
float

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

144 {
145 return $this->opacity;
146 }

References $opacity.

Referenced by parseOptions().

+ Here is the caller graph for this function:

◆ getPosition()

ilChartLegend::getPosition ( )

Get Position.

Returns
string

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

55 {
56 return $this->position;
57 }

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.

Parameters
object$a_options

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

197 {
198 $a_options->show = true;
199
200 $a_options->noColumns = $this->getColumns();
201 $a_options->position = $this->getPosition();
202
203 $margin = $this->getMargin();
204 $a_options->margin = array($margin["x"], $margin["y"]);
205
206 $a_options->backgroundColor = ilChart::renderColor($this->getBackground());
207 $a_options->backgroundOpacity = str_replace(",",".",$this->getOpacity());
208 $a_options->labelBoxBorderColor = ilChart::renderColor($this->getLabelBorder());
209
210 $container = $this->getContainer();
211 if($container)
212 {
213 $a_options->container = '#'.$container;
214 }
215 }
getPosition()
Get Position.
getLabelBorder()
Get label border.
getColumns()
Get number of columns.
getBackground()
Get background color.
getContainer()
Get container id.
getOpacity()
Get opacity.
getMargin()
Get margins.
static renderColor($a_value, $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 (   $a_color)

Set background color.

Parameters
string$a_color

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

107 {
108 if(ilChart::isValidColor($a_color))
109 {
110 $this->background = $a_color;
111 }
112 }
static isValidColor($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 (   $a_value)

Set number of columns.

Parameters
int$a_value

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

65 {
66 $this->columns = (int)$a_value;
67 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setContainer()

ilChartLegend::setContainer (   $a_value)

Set container id.

Parameters
string

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

177 {
178 $this->container = trim($a_value);
179 }

◆ setLabelBorder()

ilChartLegend::setLabelBorder (   $a_color)

Set label border.

Parameters
string$a_color

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

154 {
155 if(ilChart::isValidColor($a_color))
156 {
157 $this->border = $a_color;
158 }
159 }

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 (   $a_x,
  $a_y 
)

Set margins.

Parameters
int$a_x
int$a_y

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

86 {
87 $this->margin_x = (int)$a_x;
88 $this->margin_y = (int)$a_y;
89 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setOpacity()

ilChartLegend::setOpacity (   $a_value)

Set Opacity.

Parameters
float$a_value

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

130 {
131 $a_value = (float)$a_value;
132 if($a_value >= 0 && $a_value <= 1)
133 {
134 $this->opacity = $a_value;
135 }
136 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setPosition()

ilChartLegend::setPosition (   $a_position)

Set Position.

Parameters
string$position

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

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

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $background

ilChartLegend::$background
protected

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

Referenced by getBackground().

◆ $border

ilChartLegend::$border
protected

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

Referenced by getLabelBorder().

◆ $columns

ilChartLegend::$columns
protected

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

Referenced by getColumns().

◆ $container

ilChartLegend::$container
protected

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

Referenced by getContainer(), and parseOptions().

◆ $margin_x

ilChartLegend::$margin_x
protected

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

◆ $margin_y

ilChartLegend::$margin_y
protected

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

◆ $opacity

ilChartLegend::$opacity
protected

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

Referenced by getOpacity().

◆ $position

ilChartLegend::$position
protected

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

Referenced by getPosition().


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