ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilChartData Class Reference

Abstract chart data series base class. More...

+ Inheritance diagram for ilChartData:
+ Collaboration diagram for ilChartData:

Public Member Functions

 setHidden ($a_value)
 Set hidden. More...
 
 isHidden ()
 Is hidden? More...
 
 setLabel ($a_value)
 Set label. More...
 
 getLabel ()
 Get label. More...
 
 addPoint ($a_x, $a_y=null)
 Set data. More...
 
 getData ()
 Get data. More...
 
 setFill ($a_value, $a_color=null)
 Set fill. More...
 
 getFill ()
 Get fill. More...
 
 parseData (array &$a_data)
 Convert data to flot config. More...
 
 parseGlobalOptions (stdClass $a_options, ilChart $a_chart)
 Convert (global) properties to flot config. More...
 

Protected Member Functions

 getTypeString ()
 Get series type. More...
 
 parseDataOptions (array &$a_options)
 Convert data options to flot config. More...
 

Protected Attributes

 $type
 
 $label
 
 $data
 
 $fill
 
 $fill_color
 
 $hidden
 

Detailed Description

Abstract chart data series base class.

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

Member Function Documentation

◆ addPoint()

ilChartData::addPoint (   $a_x,
  $a_y = null 
)

Set data.

Parameters
float$a_x
float$a_y

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

References array, and data.

74  {
75  if($a_y !== null)
76  {
77  $this->data[] = array($a_x, $a_y);
78  }
79  else
80  {
81  $this->data[] = $a_x;
82  }
83  }
Add some data
Create styles array
The data for the language used.

◆ getData()

ilChartData::getData ( )

Get data.

Returns
array

Definition at line 90 of file class.ilChartData.php.

References $data.

Referenced by parseData().

91  {
92  return $this->data;
93  }
+ Here is the caller graph for this function:

◆ getFill()

ilChartData::getFill ( )

Get fill.

Returns
array (fill, color)

Definition at line 115 of file class.ilChartData.php.

References array.

Referenced by ilChartDataSpider\parseData(), parseData(), and ilChartDataPie\parseGlobalOptions().

116  {
117  return array("fill"=>$this->fill, "color"=>$this->fill_color);
118  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getLabel()

ilChartData::getLabel ( )

Get label.

Returns
string

Definition at line 62 of file class.ilChartData.php.

References $label.

Referenced by parseData().

63  {
64  return $this->label;
65  }
+ Here is the caller graph for this function:

◆ getTypeString()

ilChartData::getTypeString ( )
abstractprotected

Get series type.

Returns
string

Referenced by parseData().

+ Here is the caller graph for this function:

◆ isHidden()

ilChartData::isHidden ( )

Is hidden?

Returns
bool

Definition at line 42 of file class.ilChartData.php.

References $hidden.

Referenced by ilChartDataPie\parseData(), and parseData().

43  {
44  return $this->hidden;
45  }
+ Here is the caller graph for this function:

◆ parseData()

ilChartData::parseData ( array $a_data)

Convert data to flot config.

Parameters
array$a_data
Returns
object

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

References $fill, $options, $series, array, getData(), getFill(), getLabel(), getTypeString(), isHidden(), parseDataOptions(), and ilChart\renderColor().

138  {
139  $series = new stdClass();
140  $series->label = str_replace("\"", "\\\"", $this->getLabel());
141 
142  $series->data = array();
143  foreach($this->getData() as $point)
144  {
145  $series->data[] = array($point[0], $point[1]);
146  }
147 
148  $options = array("show"=>($this->isHidden() ? false : true));
149 
150  $fill = $this->getFill();
151  if($fill["fill"])
152  {
153  $options["fill"] = $fill["fill"];
154  if($fill["color"])
155  {
156  $options["fillColor"] = ilChart::renderColor($fill["color"], $fill["fill"]);
157  }
158  }
159 
160  $this->parseDataOptions($options);
161 
162  $series->{$this->getTypeString()} = $options;
163 
164  $a_data[] = $series;
165  }
getData()
Get data.
isHidden()
Is hidden?
if(!is_array($argv)) $options
getFill()
Get fill.
Create styles array
The data for the language used.
getTypeString()
Get series type.
static renderColor($a_value, $a_opacity=1)
Render html color code.
parseDataOptions(array &$a_options)
Convert data options to flot config.
getLabel()
Get label.
+ Here is the call graph for this function:

◆ parseDataOptions()

ilChartData::parseDataOptions ( array $a_options)
protected

Convert data options to flot config.

Parameters
array$a_options
ilChart$a_chart

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

Referenced by parseData().

127  {
128 
129  }
+ Here is the caller graph for this function:

◆ parseGlobalOptions()

ilChartData::parseGlobalOptions ( stdClass  $a_options,
ilChart  $a_chart 
)

Convert (global) properties to flot config.

Parameters
object$a_options
ilChart$a_chart

Definition at line 173 of file class.ilChartData.php.

174  {
175 
176  }

◆ setFill()

ilChartData::setFill (   $a_value,
  $a_color = null 
)

Set fill.

Parameters
float$a_value
string$a_color

Definition at line 101 of file class.ilChartData.php.

References ilChart\isValidColor().

102  {
103  $this->fill = $a_value;
104  if(ilChart::isValidColor($a_color))
105  {
106  $this->fill_color = $a_color;
107  }
108  }
static isValidColor($a_value)
Validate html color code.
+ Here is the call graph for this function:

◆ setHidden()

ilChartData::setHidden (   $a_value)

Set hidden.

Parameters
bool$a_value

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

33  {
34  $this->hidden = (bool)$a_value;
35  }

◆ setLabel()

ilChartData::setLabel (   $a_value)

Set label.

Parameters
string$a_value

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

References string.

53  {
54  $this->label = (string)$a_value;
55  }
Add rich text string
The name of the decorator.

Field Documentation

◆ $data

ilChartData::$data
protected

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

Referenced by getData().

◆ $fill

ilChartData::$fill
protected

◆ $fill_color

ilChartData::$fill_color
protected

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

◆ $hidden

ilChartData::$hidden
protected

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

Referenced by isHidden().

◆ $label

ilChartData::$label
protected

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

Referenced by getLabel(), and ilChartDataSpider\parseGlobalOptions().

◆ $type

ilChartData::$type
protected

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


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