MDL-55030 core: Call class setter when creating a new axis

Part of MDL-54987 epic.
This commit is contained in:
Frederic Massart
2016-07-25 10:42:39 +01:00
committed by Dan Poltawski
parent a6c6faefb7
commit 826ade18f1
3 changed files with 16 additions and 8 deletions
+13 -6
View File
@@ -66,20 +66,27 @@ class chart_base implements JsonSerializable, renderable {
}
private function get_axis($type, $index, $createifnotexists) {
if ($type === 'x') {
$axes = &$this->xaxes;
$isx = $type === 'x';
if ($isx) {
$axis = isset($this->xaxes[$index]) ? $this->xaxes[$index] : null;
} else {
$axes = &$this->yaxes;
$axis = isset($this->yaxes[$index]) ? $this->yaxes[$index] : null;
}
if (!isset($axes[$index])) {
if ($axis === null) {
if (!$createifnotexists) {
throw new coding_exception('Unknown axis.');
}
$axes[$index] = new chart_axis();
$axis = new chart_axis();
if ($isx) {
$this->set_xaxis($axis, $index);
} else {
$this->set_yaxis($axis, $index);
}
}
return $axes[$index];
return $axis;
}
public function get_labels() {