ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilChartDataPie Class Reference

Chart data pie series. More...

+ Inheritance diagram for ilChartDataPie:
+ Collaboration diagram for ilChartDataPie:

Public Member Functions

 setLineWidth ($a_value)
 Set line width.
 getLineWidth ()
 Get line width.
 setLabelRadius ($a_value)
 Sets the radius at which to place the labels.
 getLabelRadius ()
 addPoint ($a_value, $a_caption=null)
 Set data.
 parseData (array &$a_data)
 Convert data to flot config.
 parseGlobalOptions (stdClass $a_options, ilChart $a_chart)
 Convert (global) properties to flot config.
- Public Member Functions inherited from ilChartData
 setHidden ($a_value)
 Set hidden.
 isHidden ()
 Is hidden?
 setLabel ($a_value)
 Set label.
 getLabel ()
 Get label.
 getData ()
 Get data.
 setFill ($a_value, $a_color=null)
 Set fill.
 getFill ()
 Get fill.

Protected Member Functions

 getTypeString ()
 Get series type.
- Protected Member Functions inherited from ilChartData
 parseDataOptions (array &$a_options)
 Convert data options to flot config.

Protected Attributes

 $line_width
 $label_radius
- Protected Attributes inherited from ilChartData
 $type
 $label
 $data
 $fill
 $fill_color
 $hidden

Detailed Description

Chart data pie series.

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 13 of file class.ilChartDataPie.php.

Member Function Documentation

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

Set data.

Parameters
float$a_x
float$a_y

Reimplemented from ilChartData.

Definition at line 64 of file class.ilChartDataPie.php.

{
$this->data[] = array($a_value, $a_caption);
}
ilChartDataPie::getLabelRadius ( )
Returns
mixed

Definition at line 59 of file class.ilChartDataPie.php.

References $label_radius.

Referenced by parseData().

{
}

+ Here is the caller graph for this function:

ilChartDataPie::getLineWidth ( )

Get line width.

Returns
int

Definition at line 38 of file class.ilChartDataPie.php.

References $line_width.

{
}
ilChartDataPie::getTypeString ( )
protected

Get series type.

Returns
string

Reimplemented from ilChartData.

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

Referenced by parseData().

{
return "pie";
}

+ Here is the caller graph for this function:

ilChartDataPie::parseData ( array &  $a_data)

Convert data to flot config.

Parameters
array$a_data
Returns
object

Reimplemented from ilChartData.

Definition at line 69 of file class.ilChartDataPie.php.

References $options, getLabelRadius(), getTypeString(), and ilChartData\isHidden().

{
foreach($this->data as $slice)
{
$series = new stdClass();
$series->label = str_replace("\"", "\\\"", $slice[1]);
// add percentage to legend
if(!$this->getLabelRadius())
{
$series->label .= " (".$slice[0]."%)";
}
$series->data = $slice[0];
$options = array("show"=>($this->isHidden() ? false : true));
$series->{$this->getTypeString()} = $options;
$a_data[] = $series;
}
}

+ Here is the call graph for this function:

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

Convert (global) properties to flot config.

Parameters
object$a_options
ilChart$a_chart

Reimplemented from ilChartData.

Definition at line 92 of file class.ilChartDataPie.php.

References ilChart\renderColor().

{
$a_options->series->pie = new stdClass();
$a_options->series->pie->show = true;
// fill vs. stroke - trying to normalize data attributes
$fill = $this->getFill();
$width = $this->getLineWidth();
if($fill["fill"] || $width)
{
$a_options->series->pie->stroke = new stdClass;
if($width)
{
$a_options->series->pie->stroke->width = $width;
}
if($fill["color"])
{
$a_options->series->pie->stroke->color = ilChart::renderColor($fill["color"], $fill["fill"]);
}
}
$radius = $this->getLabelRadius();
if ($radius)
{
$a_options->series->pie->label = new stdClass;
$a_options->series->pie->label->background = new stdClass;
$a_options->series->pie->radius = 1;
$a_options->series->pie->label->radius = $radius;
$a_options->series->pie->label->show = true;
$a_options->series->pie->label->background->color = "#444";
$a_options->series->pie->label->background->opacity = 0.8;
}
}

+ Here is the call graph for this function:

ilChartDataPie::setLabelRadius (   $a_value)

Sets the radius at which to place the labels.

If value is between 0 and 1 (inclusive) then it will use that as a percentage of the available space (size of the container), otherwise it will use the value as a direct pixel length.

Parameters
mixed$a_value

Definition at line 51 of file class.ilChartDataPie.php.

{
$this->label_radius = $a_value;
}
ilChartDataPie::setLineWidth (   $a_value)

Set line width.

Parameters
int$a_value

Definition at line 28 of file class.ilChartDataPie.php.

{
$this->line_width = (int)$a_value;
}

Field Documentation

ilChartDataPie::$label_radius
protected

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

Referenced by getLabelRadius().

ilChartDataPie::$line_width
protected

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

Referenced by getLineWidth().


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