ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

Reimplemented in ilChartDataPie.

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

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 }

◆ getData()

ilChartData::getData ( )

Get data.

Returns
array

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

91 {
92 return $this->data;
93 }

References $data.

Referenced by parseData().

+ 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.

116 {
117 return array("fill"=>$this->fill, "color"=>$this->fill_color);
118 }

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

+ Here is the caller graph for this function:

◆ getLabel()

ilChartData::getLabel ( )

Get label.

Returns
string

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

63 {
64 return $this->label;
65 }

References $label.

Referenced by parseData().

+ Here is the caller graph for this function:

◆ getTypeString()

ilChartData::getTypeString ( )
abstractprotected

Get series type.

Returns
string

Reimplemented in ilChartDataBars, ilChartDataLines, ilChartDataPie, ilChartDataPoints, and ilChartDataSpider.

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.

43 {
44 return $this->hidden;
45 }

References $hidden.

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

+ 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

Reimplemented in ilChartDataPie, and ilChartDataSpider.

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

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
161
162 $series->{$this->getTypeString()} = $options;
163
164 $a_data[] = $series;
165 }
getTypeString()
Get series type.
getFill()
Get fill.
parseDataOptions(array &$a_options)
Convert data options to flot config.
getData()
Get data.
getLabel()
Get label.
isHidden()
Is hidden?
static renderColor($a_value, $a_opacity=1)
Render html color code.
if(!is_array($argv)) $options

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

+ 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

Reimplemented in ilChartDataBars, ilChartDataLines, and ilChartDataPoints.

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

127 {
128
129 }

Referenced by parseData().

+ 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

Reimplemented in ilChartDataPie, and ilChartDataSpider.

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.

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.

References ilChart\isValidColor().

+ 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.

53 {
54 $this->label = (string)$a_value;
55 }

Field Documentation

◆ $data

ilChartData::$data
protected

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

Referenced by getData().

◆ $fill

ilChartData::$fill
protected

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

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

◆ $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: