ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

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

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  }
setLabelBorder($a_color)
Set label border.
setMargin($a_x, $a_y)
Set margins.
setOpacity($a_value)
Set Opacity.
setColumns($a_value)
Set number of columns.
setBackground($a_color)
Set background color.
setPosition($a_position)
Set Position.
+ 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.

References $background.

Referenced by parseOptions().

120  {
121  return $this->background;
122  }
+ 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.

References $columns.

Referenced by parseOptions().

75  {
76  return $this->columns;
77  }
+ 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.

References $container.

Referenced by parseOptions().

187  {
188  return $this->container;
189  }
+ 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.

References $border.

Referenced by parseOptions().

167  {
168  return $this->border;
169  }
+ 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.

References array.

Referenced by parseOptions().

97  {
98  return array("x"=>$this->margin_x, "y"=>$this->margin_y);
99  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getOpacity()

ilChartLegend::getOpacity ( )

Get opacity.

Returns
float

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

References $opacity.

Referenced by parseOptions().

144  {
145  return $this->opacity;
146  }
+ Here is the caller graph for this function:

◆ getPosition()

ilChartLegend::getPosition ( )

Get Position.

Returns
string

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

References $position.

Referenced by parseOptions().

55  {
56  return $this->position;
57  }
+ 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.

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

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  }
getLabelBorder()
Get label border.
getMargin()
Get margins.
getContainer()
Get container id.
getOpacity()
Get opacity.
Create styles array
The data for the language used.
static renderColor($a_value, $a_opacity=1)
Render html color code.
getBackground()
Get background color.
getColumns()
Get number of columns.
getPosition()
Get Position.
+ 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.

References ilChart\isValidColor().

Referenced by __construct().

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

References columns.

Referenced by __construct().

65  {
66  $this->columns = (int)$a_value;
67  }
Play around with inserting and removing rows and columns
+ 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.

References ilChart\isValidColor().

Referenced by __construct().

154  {
155  if(ilChart::isValidColor($a_color))
156  {
157  $this->border = $a_color;
158  }
159  }
static isValidColor($a_value)
Validate html color code.
+ 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.

Referenced by __construct().

86  {
87  $this->margin_x = (int)$a_x;
88  $this->margin_y = (int)$a_y;
89  }
+ 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.

Referenced by __construct().

130  {
131  $a_value = (float)$a_value;
132  if($a_value >= 0 && $a_value <= 1)
133  {
134  $this->opacity = $a_value;
135  }
136  }
+ 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.

References array, and string.

Referenced by __construct().

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  }
Add rich text string
The name of the decorator.
Create styles array
The data for the language used.
+ 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: