Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

Chart series.

Copyright: 2016 Frédéric Massart - FMCorz.net
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 279 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

chart_series:: (22 methods):
  __construct()
  get_color()
  get_colors()
  get_count()
  get_fill()
  get_label()
  get_labels()
  get_smooth()
  get_type()
  get_values()
  get_xaxis()
  get_yaxis()
  has_colored_values()
  jsonSerialize()
  set_color()
  set_colors()
  set_fill()
  set_labels()
  set_smooth()
  set_type()
  set_xaxis()
  set_yaxis()


Class: chart_series  - X-Ref

Chart series class.

__construct($label, $values)   X-Ref
Constructor.

param: string $label The label of the series.
param: float[] $values The values of this series.

get_color()   X-Ref
Get the color.

return: string|null

get_colors()   X-Ref
Get the colors for each value in the series.

return: string[]

get_count()   X-Ref
Get the number of values in this series.

return: int

get_fill()   X-Ref
Get area fill mode for series.


get_label()   X-Ref
Get the label of the series.

return: string

get_labels()   X-Ref
Set labels for the values of the series.

return: array

get_smooth()   X-Ref
Get whether the line of the serie should be smooth or not.

return: bool

get_type()   X-Ref
Get the type of series.

return: string

get_values()   X-Ref
Get the values of the series.

return: string[]

get_xaxis()   X-Ref
Get the index of the X axis.

return: int

get_yaxis()   X-Ref
Get the index of the Y axis.

return: int

has_colored_values()   X-Ref
Whether there is a color per value.

return: bool

jsonSerialize()   X-Ref
Serialize the object.

return: array

set_color($color)   X-Ref
Set the color of the series.

param: string $color CSS compatible color.

set_colors(array $colors)   X-Ref
Set a color for each value in the series.

param: string[] $colors CSS compatible colors.

set_fill($fill)   X-Ref
Set fill mode for the series.

param: string $fill

set_labels($labels)   X-Ref
Set labels for the values of the series.

param: array $labels The labels for the series values.

set_smooth($smooth)   X-Ref
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).

param: bool $smooth True if the line should be smooth, false for tensioned lines.

set_type($type)   X-Ref
Set the type of the series.

param: string $type Constant value from self::TYPE_*.

set_xaxis($index)   X-Ref
Set the index of the X axis.

param: int $index The index.

set_yaxis($index)   X-Ref
Set the index of the Y axis.

param: int $index The index.