ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 117 of file class.ilChartLegend.php.

References $background.

Referenced by parseOptions().

118  {
119  return $this->background;
120  }
+ Here is the caller graph for this function:

◆ getColumns()

ilChartLegend::getColumns ( )

Get number of columns.

Returns
int

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

References $columns.

Referenced by parseOptions().

74  {
75  return $this->columns;
76  }
+ Here is the caller graph for this function:

◆ getContainer()

ilChartLegend::getContainer ( )

Get container id.

Returns
string

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

References $container.

Referenced by parseOptions().

183  {
184  return $this->container;
185  }
+ Here is the caller graph for this function:

◆ getLabelBorder()

ilChartLegend::getLabelBorder ( )

Get label border.

Returns
string

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

References $border.

Referenced by parseOptions().

163  {
164  return $this->border;
165  }
+ Here is the caller graph for this function:

◆ getMargin()

ilChartLegend::getMargin ( )

Get margins.

Returns
array (x, y)

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

Referenced by parseOptions().

96  {
97  return array("x" => $this->margin_x, "y" => $this->margin_y);
98  }
+ Here is the caller graph for this function:

◆ getOpacity()

ilChartLegend::getOpacity ( )

Get opacity.

Returns
float

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

References $opacity.

Referenced by parseOptions().

141  {
142  return $this->opacity;
143  }
+ Here is the caller graph for this function:

◆ getPosition()

ilChartLegend::getPosition ( )

Get Position.

Returns
string

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

References $position.

Referenced by parseOptions().

54  {
55  return $this->position;
56  }
+ 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 192 of file class.ilChartLegend.php.

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

193  {
194  $a_options->show = true;
195 
196  $a_options->noColumns = $this->getColumns();
197  $a_options->position = $this->getPosition();
198 
199  $margin = $this->getMargin();
200  $a_options->margin = array($margin["x"], $margin["y"]);
201 
202  $a_options->backgroundColor = ilChart::renderColor($this->getBackground());
203  $a_options->backgroundOpacity = str_replace(",", ".", $this->getOpacity());
204  $a_options->labelBoxBorderColor = ilChart::renderColor($this->getLabelBorder());
205 
206  $container = $this->getContainer();
207  if ($container) {
208  $a_options->container = '#' . $container;
209  }
210  }
getLabelBorder()
Get label border.
getMargin()
Get margins.
getContainer()
Get container id.
getOpacity()
Get opacity.
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 105 of file class.ilChartLegend.php.

References ilChart\isValidColor().

Referenced by __construct().

106  {
107  if (ilChart::isValidColor($a_color)) {
108  $this->background = $a_color;
109  }
110  }
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 63 of file class.ilChartLegend.php.

Referenced by __construct().

64  {
65  $this->columns = (int) $a_value;
66  }
+ Here is the caller graph for this function:

◆ setContainer()

ilChartLegend::setContainer (   $a_value)

Set container id.

Parameters
string

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

173  {
174  $this->container = trim($a_value);
175  }

◆ setLabelBorder()

ilChartLegend::setLabelBorder (   $a_color)

Set label border.

Parameters
string$a_color

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

References ilChart\isValidColor().

Referenced by __construct().

151  {
152  if (ilChart::isValidColor($a_color)) {
153  $this->border = $a_color;
154  }
155  }
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 84 of file class.ilChartLegend.php.

Referenced by __construct().

85  {
86  $this->margin_x = (int) $a_x;
87  $this->margin_y = (int) $a_y;
88  }
+ Here is the caller graph for this function:

◆ setOpacity()

ilChartLegend::setOpacity (   $a_value)

Set Opacity.

Parameters
float$a_value

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

Referenced by __construct().

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

Referenced by __construct().

41  {
42  $all = array("ne", "nw", "se", "sw");
43  if (in_array((string) $a_position, $all)) {
44  $this->position = (string) $a_position;
45  }
46  }
+ 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: