ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $this->data[] = array($a_x, $a_y);
77  } else {
78  $this->data[] = $a_x;
79  }
80  }
Add some data
Create styles array
The data for the language used.

◆ getData()

ilChartData::getData ( )

Get data.

Returns
array

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

References $data.

Referenced by parseData().

88  {
89  return $this->data;
90  }
+ Here is the caller graph for this function:

◆ getFill()

ilChartData::getFill ( )

Get fill.

Returns
array (fill, color)

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

References array.

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

112  {
113  return array("fill"=>$this->fill, "color"=>$this->fill_color);
114  }
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 132 of file class.ilChartData.php.

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

133  {
134  $series = new stdClass();
135  $series->label = str_replace("\"", "\\\"", $this->getLabel());
136 
137  $series->data = array();
138  foreach ($this->getData() as $point) {
139  $series->data[] = array($point[0], $point[1]);
140  }
141 
142  $options = array("show"=>($this->isHidden() ? false : true));
143 
144  $fill = $this->getFill();
145  if ($fill["fill"]) {
146  $options["fill"] = $fill["fill"];
147  if ($fill["color"]) {
148  $options["fillColor"] = ilChart::renderColor($fill["color"], $fill["fill"]);
149  }
150  }
151 
152  $this->parseDataOptions($options);
153 
154  $series->{$this->getTypeString()} = $options;
155 
156  $a_data[] = $series;
157  }
getData()
Get data.
isHidden()
Is hidden?
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.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ 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 122 of file class.ilChartData.php.

Referenced by parseData().

123  {
124  }
+ 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 165 of file class.ilChartData.php.

166  {
167  }

◆ setFill()

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

Set fill.

Parameters
float$a_value
string$a_color

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

References ilChart\isValidColor().

99  {
100  $this->fill = $a_value;
101  if (ilChart::isValidColor($a_color)) {
102  $this->fill_color = $a_color;
103  }
104  }
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

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: