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

Generator for grid-based charts. More...

+ Inheritance diagram for ilChartGrid:
+ Collaboration diagram for ilChartGrid:

Public Member Functions

 getDataInstance ($a_type=null)
 Get data series instance.
 setTicks ($a_x, $a_y, $a_labeled=false)
 Set ticks.
 getTicks ()
 Get ticks.
 setYAxisToInteger ($a_status)
 Restrict y-axis to integer values.
 setXAxisToInteger ($a_status)
 Restrict x-axis to integer values.
 parseGlobalOptions (stdClass $a_options)
 Convert (global) properties to flot config.
- Public Member Functions inherited from ilChart
 setSize ($a_x, $a_y)
 Set chart size.
 addData (ilChartData $a_series, $a_idx=null)
 Add data series.
 setLegend (ilChartLegend $a_legend)
 Set chart legend.
 setColors ($a_values)
 Set colors.
 getColors ()
 Get colors.
 setShadow ($a_value)
 Set shadow.
 getShadow ()
 Get shadow.
 setAutoResize ($a_value)
 Toggle auto-resizing on window resize/redraw.
 getHTML ()
 Render.

Data Fields

const DATA_LINES = 1
const DATA_BARS = 2
const DATA_POINTS = 3
- Data Fields inherited from ilChart
const TYPE_GRID = 1
const TYPE_PIE = 2
const TYPE_SPIDER = 3

Protected Member Functions

 __construct ($a_id)
 Constructor.
 isValidDataType (ilChartData $a_series)
 Validate data series.
- Protected Member Functions inherited from ilChart
 isValid ()
 Basic validation.
 initJS ()
 Init JS script files.
 addCustomJS ()
 Add type-specific JS script.

Protected Attributes

 $ticks
 $integer_axis
- Protected Attributes inherited from ilChart
 $id
 $width
 $height
 $data
 $legend
 $shadow
 $colors
 $auto_resize

Additional Inherited Members

- Static Public Member Functions inherited from ilChart
static getInstanceByType ($a_type, $a_id)
 Get type instance.
static isValidColor ($a_value)
 Validate html color code.
static renderColor ($a_value, $a_opacity=1)
 Render html color code.

Detailed Description

Generator for grid-based charts.

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

Constructor & Destructor Documentation

ilChartGrid::__construct (   $a_id)
protected

Constructor.

Parameters
string$a_id

Reimplemented from ilChart.

Definition at line 22 of file class.ilChartGrid.php.

References setXAxisToInteger(), and setYAxisToInteger().

{
$this->setXAxisToInteger(false);
$this->setYAxisToInteger(false);
}

+ Here is the call graph for this function:

Member Function Documentation

ilChartGrid::getDataInstance (   $a_type = null)

Get data series instance.

Returns
ilChartData

Reimplemented from ilChart.

Definition at line 30 of file class.ilChartGrid.php.

{
switch($a_type)
{
case self::DATA_BARS:
include_once "Services/Chart/classes/class.ilChartDataBars.php";
return new ilChartDataBars();
case self::DATA_POINTS:
include_once "Services/Chart/classes/class.ilChartDataPoints.php";
return new ilChartDataPoints();
default:
case self::DATA_LINES:
include_once "Services/Chart/classes/class.ilChartDataLines.php";
return new ilChartDataLines();
}
}
ilChartGrid::getTicks ( )

Get ticks.

Returns
array (x, y)

Definition at line 77 of file class.ilChartGrid.php.

References $ticks.

Referenced by parseGlobalOptions().

{
return $this->ticks;
}

+ Here is the caller graph for this function:

ilChartGrid::isValidDataType ( ilChartData  $a_series)
protected

Validate data series.

Returns
bool

Reimplemented from ilChart.

Definition at line 49 of file class.ilChartGrid.php.

{
if($a_series instanceof ilChartDataLines
|| $a_series instanceof ilChartDataBars
|| $a_series instanceof ilChartDataPoints)
{
return true;
}
return false;
}
ilChartGrid::parseGlobalOptions ( stdClass  $a_options)

Convert (global) properties to flot config.

Parameters
object$a_options

Reimplemented from ilChart.

Definition at line 102 of file class.ilChartGrid.php.

References $ticks, and getTicks().

{
// axis/ticks
$tmp = array();
$ticks = $this->getTicks();
if($ticks)
{
$labeled = (bool)$ticks["labeled"];
unset($ticks["labeled"]);
foreach($ticks as $axis => $def)
{
if(is_numeric($def) || is_array($def))
{
$a_options->{$axis."axis"} = new stdClass();
}
if(is_numeric($def))
{
$a_options->{$axis."axis"}->ticks = $def;
}
else if(is_array($def))
{
$a_options->{$axis."axis"}->ticks = array();
foreach($def as $idx => $value)
{
if($labeled)
{
$a_options->{$axis."axis"}->ticks[] = array($idx, $value);
}
else
{
$a_options->{$axis."axis"}->ticks[] = $value;
}
}
}
}
}
// optional: remove decimals
if($this->integer_axis["x"] && !isset($a_options->xaxis))
{
$a_options->{"xaxis"} = new stdClass();
$a_options->{"xaxis"}->tickDecimals = 0;
}
if($this->integer_axis["y"] && !isset($a_options->yaxis))
{
$a_options->{"yaxis"} = new stdClass();
$a_options->{"yaxis"}->tickDecimals = 0;
}
}

+ Here is the call graph for this function:

ilChartGrid::setTicks (   $a_x,
  $a_y,
  $a_labeled = false 
)

Set ticks.

Parameters
int | array$a_x
int | array$a_y
bool$a_labeled

Definition at line 67 of file class.ilChartGrid.php.

{
$this->ticks = array("x" => $a_x, "y" => $a_y, "labeled" => (bool)$a_labeled);
}
ilChartGrid::setXAxisToInteger (   $a_status)

Restrict x-axis to integer values.

Parameters
bool$a_status

Definition at line 97 of file class.ilChartGrid.php.

Referenced by __construct().

{
$this->integer_axis["x"] = (bool)$a_status;
}

+ Here is the caller graph for this function:

ilChartGrid::setYAxisToInteger (   $a_status)

Restrict y-axis to integer values.

Parameters
bool$a_status

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

Referenced by __construct().

{
$this->integer_axis["y"] = (bool)$a_status;
}

+ Here is the caller graph for this function:

Field Documentation

ilChartGrid::$integer_axis
protected

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

ilChartGrid::$ticks
protected

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

Referenced by getTicks(), and parseGlobalOptions().

const ilChartGrid::DATA_BARS = 2
const ilChartGrid::DATA_POINTS = 3

Definition at line 20 of file class.ilChartGrid.php.


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