Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
core\chart_series Class Reference

Chart series class. More...

Inheritance diagram for core\chart_series:

Public Member Functions

 __construct ($label, $values)
 Constructor. More...
 
 get_color ()
 Get the color. More...
 
 get_colors ()
 Get the colors for each value in the series. More...
 
 get_count ()
 Get the number of values in this series. More...
 
 get_label ()
 Get the label of the series. More...
 
 get_labels ()
 Set labels for the values of the series. More...
 
 get_smooth ()
 Get whether the line of the serie should be smooth or not. More...
 
 get_type ()
 Get the type of series. More...
 
 get_values ()
 Get the values of the series. More...
 
 get_xaxis ()
 Get the index of the X axis. More...
 
 get_yaxis ()
 Get the index of the Y axis. More...
 
 has_colored_values ()
 Whether there is a color per value. More...
 
 jsonSerialize ()
 Serialize the object. More...
 
 set_color ($color)
 Set the color of the series. More...
 
 set_colors (array $colors)
 Set a color for each value in the series. More...
 
 set_labels ($labels)
 Set labels for the values of the series. More...
 
 set_smooth ($smooth)
 Set whether the line of the serie should be smooth or not. More...
 
 set_type ($type)
 Set the type of the series. More...
 
 set_xaxis ($index)
 Set the index of the X axis. More...
 
 set_yaxis ($index)
 Set the index of the Y axis. More...
 

Public Attributes

const TYPE_DEFAULT = null
 Default type for a series.
 
const TYPE_LINE = 'line'
 Series of type line.
 

Protected Attributes

string[] $colors = []
 Colors of the series.
 
string $label
 Label for this series.
 
string[] $labels = null
 Labels for the values of the series.
 
bool $smooth = null
 Whether the line of the serie should be smooth or not.
 
string $type = self::TYPE_DEFAULT
 Type of the series.
 
float[] $values = []
 Values of the series.
 
int $xaxis = null
 Index of the X axis.
 
int $yaxis = null
 Index of the Y axis.
 

Detailed Description

Chart series class.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core\chart_series::__construct (   $label,
  $values 
)

Constructor.

Parameters
string$labelThe label of the series.
float[]$valuesThe values of this series.

Member Function Documentation

◆ get_color()

core\chart_series::get_color ( )

Get the color.

Return values
string|null

◆ get_colors()

core\chart_series::get_colors ( )

Get the colors for each value in the series.

Return values
string[]

◆ get_count()

core\chart_series::get_count ( )

Get the number of values in this series.

Return values
int

◆ get_label()

core\chart_series::get_label ( )

Get the label of the series.

Return values
string

◆ get_labels()

core\chart_series::get_labels ( )

Set labels for the values of the series.

Return values
array

◆ get_smooth()

core\chart_series::get_smooth ( )

Get whether the line of the serie should be smooth or not.

Return values
bool

◆ get_type()

core\chart_series::get_type ( )

Get the type of series.

Return values
string

◆ get_values()

core\chart_series::get_values ( )

Get the values of the series.

Return values
string[]

◆ get_xaxis()

core\chart_series::get_xaxis ( )

Get the index of the X axis.

Return values
int

◆ get_yaxis()

core\chart_series::get_yaxis ( )

Get the index of the Y axis.

Return values
int

◆ has_colored_values()

core\chart_series::has_colored_values ( )

Whether there is a color per value.

Return values
bool

◆ jsonSerialize()

core\chart_series::jsonSerialize ( )

Serialize the object.

Return values
array

◆ set_color()

core\chart_series::set_color (   $color)

Set the color of the series.

Parameters
string$colorCSS compatible color.

◆ set_colors()

core\chart_series::set_colors ( array  $colors)

Set a color for each value in the series.

Parameters
string[]$colorsCSS compatible colors.

◆ set_labels()

core\chart_series::set_labels (   $labels)

Set labels for the values of the series.

Parameters
array$labelsThe labels for the series values.

◆ set_smooth()

core\chart_series::set_smooth (   $smooth)

Set whether the line of the serie should be smooth or not.

Only applicable for line chart or a line series, if null it assumes the chart default (not smooth).

Parameters
bool$smoothTrue if the line should be smooth, false for tensioned lines.

◆ set_type()

core\chart_series::set_type (   $type)

Set the type of the series.

Parameters
string$typeConstant value from self::TYPE_*.

◆ set_xaxis()

core\chart_series::set_xaxis (   $index)

Set the index of the X axis.

Parameters
int$indexThe index.

◆ set_yaxis()

core\chart_series::set_yaxis (   $index)

Set the index of the Y axis.

Parameters
int$indexThe index.

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