mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
MDL-55110 core: Add support for smooth lines
Part of MDL-54987 epic.
This commit is contained in:
parent
cc8438d112
commit
f0f1e0310e
8 changed files with 151 additions and 5 deletions
|
@ -46,6 +46,8 @@ class chart_series implements JsonSerializable {
|
|||
protected $colors = [];
|
||||
/** @var string Label for this series. */
|
||||
protected $label;
|
||||
/** @var bool Whether the line of the serie should be smooth or not. */
|
||||
protected $smooth = null;
|
||||
/** @var string Type of the series. */
|
||||
protected $type = self::TYPE_DEFAULT;
|
||||
/** @var float[] Values of the series. */
|
||||
|
@ -102,6 +104,15 @@ class chart_series implements JsonSerializable {
|
|||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether the line of the serie should be smooth or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function get_smooth() {
|
||||
return $this->smooth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of series.
|
||||
*
|
||||
|
@ -161,7 +172,8 @@ class chart_series implements JsonSerializable {
|
|||
'axes' => [
|
||||
'x' => $this->xaxis,
|
||||
'y' => $this->yaxis,
|
||||
]
|
||||
],
|
||||
'smooth' => $this->smooth
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
@ -184,6 +196,17 @@ class chart_series implements JsonSerializable {
|
|||
$this->colors = $colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 true if the line should be smooth, false if not.
|
||||
*/
|
||||
public function set_smooth($smooth) {
|
||||
$this->smooth = $smooth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the type of the series.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue