HAxis   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 229
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 41
c 1
b 0
f 0
dl 0
loc 229
ccs 0
cts 40
cp 0
rs 10
wmc 14

14 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setMinTextSpacing() 0 5 1
A setTextPosition() 0 5 1
A setSlantedTextAngle() 0 5 1
A getTitleTextStyle() 0 3 1
A setTicks() 0 5 1
A getViewWindow() 0 3 1
A setAllowContainerBoundaryTextCufoff() 0 5 1
A setMaxTextLines() 0 5 1
A setSlantedText() 0 5 1
A setDirection() 0 5 1
A setShowTextEvery() 0 5 1
A getTextStyle() 0 3 1
A setMaxAlternation() 0 5 1
1
<?php
2
3
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options\SteppedAreaChart;
4
5
use CMEN\GoogleChartsBundle\GoogleCharts\Options\TextStyle;
6
use CMEN\GoogleChartsBundle\GoogleCharts\Options\TitleTextStyle;
7
use CMEN\GoogleChartsBundle\GoogleCharts\Options\TitleTrait;
8
use CMEN\GoogleChartsBundle\GoogleCharts\Options\ViewWindow;
9
10
/**
11
 * @author Christophe Meneses
12
 */
13
class HAxis
14
{
15
    use TitleTrait;
16
17
    /**
18
     * If false, will hide outermost labels rather than allow them to be cropped by the chart container. If true,
19
     * will allow label cropping.
20
     *
21
     * @var bool
22
     */
23
    protected $allowContainerBoundaryTextCufoff;
24
25
    /**
26
     * The direction in which the values along the horizontal axis grow. Specify -1 to reverse the order of the values
27
     * or 1 for normal order.
28
     *
29
     * @var int
30
     */
31
    protected $direction;
32
33
    /**
34
     * If true, draw the horizontal axis text at an angle, to help fit more text along the axis; if false, draw
35
     * horizontal axis text upright. Default behavior is to slant text if it cannot all fit when drawn upright.
36
     * Notice that this option is available only when the hAxis.textPosition is set to 'out' (which is the default).
37
     *
38
     * @var bool
39
     */
40
    protected $slantedText;
41
42
    /**
43
     * The angle of the horizontal axis text, if it's drawn slanted. Ignored if hAxis.slantedText is false, or is in
44
     * auto mode, and the chart decided to draw the text horizontally.
45
     *
46
     * @var int
47
     */
48
    protected $slantedTextAngle;
49
50
    /**
51
     * Maximum number of levels of horizontal axis text. If axis text labels become too crowded, the server might
52
     * shift neighboring labels up or down in order to fit labels closer together. This value specifies the most
53
     * number of levels to use; the server can use fewer levels, if labels can fit without overlapping.
54
     *
55
     * @var int
56
     */
57
    protected $maxAlternation;
58
59
    /**
60
     * Maximum number of lines allowed for the text labels. Labels can span multiple lines if they are too long,
61
     * and the nuber of lines is, by default, limited by the height of the available space.
62
     *
63
     * @var int
64
     */
65
    protected $maxTextLines;
66
67
    /**
68
     * Minimum horizontal spacing, in pixels, allowed between two adjacent text labels. If the labels are spaced too
69
     * densely, or they are too long, the spacing can drop below this threshold, and in this case one of the
70
     * label-unclutter measures will be applied (e.g, truncating the lables or dropping some of them).
71
     *
72
     * @var int
73
     */
74
    protected $minTextSpacing;
75
76
    /**
77
     * How many horizontal axis labels to show, where 1 means show every label, 2 means show every other label,
78
     * and so on. Default is to try to show as many labels as possible without overlapping.
79
     *
80
     * @var int
81
     */
82
    protected $showTextEvery;
83
84
    /**
85
     * Position of the horizontal axis text, relative to the chart area. Supported values: 'out', 'in', 'none'.
86
     *
87
     * @var string
88
     */
89
    protected $textPosition;
90
91
    /**
92
     * @var TextStyle
93
     */
94
    protected $textStyle;
95
96
    /**
97
     * Replaces the automatically generated X-axis ticks with the specified array. Each element of the array should be
98
     * either a valid tick value (such as a number, date, datetime, or timeofday), or an array. If it's an array, it
99
     * should have a v property for the tick value, and an optional f property containing the literal string to be
100
     * displayed as the label. Examples :
101
     * [5, 10, 15, 20]
102
     * [['v' => 32, 'f' => 'thirty two'], ['v' => 64, 'f' => 'sixty four']].
103
     *
104
     * This option is only supported for a continuous axis.
105
     *
106
     * @var array<mixed>
107
     */
108
    protected $ticks;
109
110
    /**
111
     * @var TitleTextStyle
112
     */
113
    protected $titleTextStyle;
114
115
    /**
116
     * @var ViewWindow
117
     */
118
    protected $viewWindow;
119
120
    public function __construct()
121
    {
122
        $this->textStyle = new TextStyle();
123
        $this->titleTextStyle = new TitleTextStyle();
124
        $this->viewWindow = new ViewWindow();
125
    }
126
127
    public function getTextStyle(): TextStyle
128
    {
129
        return $this->textStyle;
130
    }
131
132
    public function getTitleTextStyle(): TitleTextStyle
133
    {
134
        return $this->titleTextStyle;
135
    }
136
137
    public function getViewWindow(): ViewWindow
138
    {
139
        return $this->viewWindow;
140
    }
141
142
    /**
143
     * @param array<mixed> $ticks
144
     *
145
     * @return $this
146
     */
147
    public function setTicks(array $ticks)
148
    {
149
        $this->ticks = $ticks;
150
151
        return $this;
152
    }
153
154
    /**
155
     * @return $this
156
     */
157
    public function setDirection(int $direction)
158
    {
159
        $this->direction = $direction;
160
161
        return $this;
162
    }
163
164
    /**
165
     * @return $this
166
     */
167
    public function setShowTextEvery(int $showTextEvery)
168
    {
169
        $this->showTextEvery = $showTextEvery;
170
171
        return $this;
172
    }
173
174
    /**
175
     * @return $this
176
     */
177
    public function setAllowContainerBoundaryTextCufoff(bool $allowContainerBoundaryTextCufoff)
178
    {
179
        $this->allowContainerBoundaryTextCufoff = $allowContainerBoundaryTextCufoff;
180
181
        return $this;
182
    }
183
184
    /**
185
     * @return $this
186
     */
187
    public function setSlantedText(bool $slantedText)
188
    {
189
        $this->slantedText = $slantedText;
190
191
        return $this;
192
    }
193
194
    /**
195
     * @return $this
196
     */
197
    public function setSlantedTextAngle(int $slantedTextAngle)
198
    {
199
        $this->slantedTextAngle = $slantedTextAngle;
200
201
        return $this;
202
    }
203
204
    /**
205
     * @return $this
206
     */
207
    public function setMaxAlternation(int $maxAlternation)
208
    {
209
        $this->maxAlternation = $maxAlternation;
210
211
        return $this;
212
    }
213
214
    /**
215
     * @return $this
216
     */
217
    public function setMaxTextLines(int $maxTextLines)
218
    {
219
        $this->maxTextLines = $maxTextLines;
220
221
        return $this;
222
    }
223
224
    /**
225
     * @return $this
226
     */
227
    public function setMinTextSpacing(int $minTextSpacing)
228
    {
229
        $this->minTextSpacing = $minTextSpacing;
230
231
        return $this;
232
    }
233
234
    /**
235
     * @return $this
236
     */
237
    public function setTextPosition(string $textPosition)
238
    {
239
        $this->textPosition = $textPosition;
240
241
        return $this;
242
    }
243
}
244