MDL-55030 core: Call class setter when creating a new axis
Part of MDL-54987 epic.
This commit is contained in:
committed by
Dan Poltawski
parent
a6c6faefb7
commit
826ade18f1
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user