ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Axis.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26abstract class Axis
27{
28 protected string $type = "linear";
29 protected bool $displayed = true;
30 protected float $step_size = 1.0;
31 protected bool $begin_at_zero = true;
32 protected ?int $min = null;
33 protected ?int $max = null;
34
35
36 abstract public function getAbbreviation(): string;
37
38 public function getType(): string
39 {
40 return $this->type;
41 }
42
46 public function withDisplayed(bool $displayed): self
47 {
48 $clone = clone $this;
49 $clone->displayed = $displayed;
50 return $clone;
51 }
52
53 public function isDisplayed(): bool
54 {
55 return $this->displayed;
56 }
57
58 abstract public function withPosition(string $position): self;
59
60 abstract public function getPosition(): string;
61
66 public function withStepSize(float $step_size): self
67 {
68 $clone = clone $this;
69 $clone->step_size = $step_size;
70 return $clone;
71 }
72
73 public function getStepSize(): float
74 {
75 return $this->step_size;
76 }
77
82 public function withBeginAtZero(bool $begin_at_zero): self
83 {
84 $clone = clone $this;
85 $clone->begin_at_zero = $begin_at_zero;
86 return $clone;
87 }
88
89 public function isBeginAtZero(): bool
90 {
92 }
93
98 public function withMinValue(int $min): self
99 {
100 $clone = clone $this;
101 $clone->min = $min;
102 return $clone;
103 }
104
105 public function getMinValue(): ?int
106 {
107 return $this->min;
108 }
109
114 public function withMaxValue(int $max): self
115 {
116 $clone = clone $this;
117 $clone->max = $max;
118 return $clone;
119 }
120
121 public function getMaxValue(): ?int
122 {
123 return $this->max;
124 }
125}
withDisplayed(bool $displayed)
Should the axis be displayed? Default is true.
Definition: Axis.php:46
withBeginAtZero(bool $begin_at_zero)
If true, bars start always at x=0 (Horizontal Bar Chart) or y=0 (Vertical Bar Chart).
Definition: Axis.php:82
withMinValue(int $min)
Numeric label values below this number will not be shown on the x-axis (Horizontal Bar Chart) or y-ax...
Definition: Axis.php:98
withStepSize(float $step_size)
Step size between each label on the x-axis.
Definition: Axis.php:66
withMaxValue(int $max)
Numeric label values above this number will not be shown on the x-axis (Horizontal Bar Chart) or y-ax...
Definition: Axis.php:114