Completed
Push — master ( 110a17...f6145a )
by Christophe
03:27
created

VAxis::setScaleType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options;
4
5
/**
6
 * @author Christophe Meneses
7
 */
8
class VAxis
9
{
10
    /**
11
     * vAxis property that specifies the baseline for the vertical axis. If the baseline is larger than the highest
12
     * grid line or smaller than the lowest grid line, it will be rounded to the closest gridline.
13
     *
14
     * @var int
15
     */
16
    protected $baseline;
17
18
    /**
19
     * Specifies the color of the baseline for the vertical axis. Can be any HTML color string,
20
     * for example: 'red' or '#00cc00'.
21
     *
22
     * @var string
23
     */
24
    protected $baselineColor;
25
26
    /**
27
     * The direction in which the values along the vertical axis grow. Specify -1 to reverse the order of the values.
28
     * Default : 1
29
     *
30
     * @var int
31
     */
32
    protected $direction;
33
34
    /**
35
     * A format string for numeric axis labels. This is a subset of the ICU pattern set . For instance,
36
     * '#,###%' will display values "1,000%", "750%", and "50%" for values 10, 7.5, and 0.5. You can also
37
     * supply any of the following :
38
     * 'none' : displays numbers with no formatting (e.g., 8000000)
39
     * 'decimal' : displays numbers with thousands separators (e.g., 8,000,000)
40
     * 'scientific' : displays numbers in scientific notation (e.g., 8e6)
41
     * 'currency' : displays numbers in the local currency (e.g., $8,000,000.00)
42
     * 'percent' : displays numbers as percentages (e.g., 800,000,000%)
43
     * 'short' : displays abbreviated numbers (e.g., 8M)
44
     * 'long' : displays numbers as full words (e.g., 8 million)
45
     *
46
     * The actual formatting applied to the label is derived from the locale the API has been loaded with.
47
     * For more details, see loading charts with a specific locale.
48
     *
49
     * @var string
50
     */
51
    protected $format;
52
53
    /**
54
     * @var Gridlines
55
     */
56
    protected $gridlines;
57
58
    /**
59
     * @var MinorGridlines
60
     */
61
    protected $minorGridlines;
62
63
    /**
64
     * If true, makes the vertical axis a logarithmic scale. Note : All values must be positive.
65
     *
66
     * @var boolean
67
     */
68
    protected $logScale;
69
70
    /**
71
     *  vAxis property that makes the vertical axis a logarithmic scale. Can be one of the following:
72
     *
73
     * - null : No logarithmic scaling is performed.
74
     * - 'log' : Logarithmic scaling. Negative and zero values are not plotted. This option is the same as setting
75
     *     hAxis: { logscale: true }.
76
     * - 'mirrorLog' : Logarithmic scaling in which negative and zero values are plotted. The plotted value of a
77
     *     negative number is the negative of the log of the absolute value. Values close to 0 are plotted on a
78
     *     linear scale.
79
     *
80
     * This option is only supported for a continuous axis.
81
     *
82
     * @var string
83
     */
84
    protected $scaleType;
85
86
    /**
87
     * Position of the vertical axis text, relative to the chart area. Supported values: 'out', 'in', 'none'.
88
     *
89
     * @var string
90
     */
91
    protected $textPosition;
92
93
    /**
94
     * @var MediumTextStyle
95
     */
96
    protected $textStyle;
97
98
    /**
99
     * Replaces the automatically generated Y-axis ticks with the specified array. Each element of the array should
100
     * be either a valid tick value (such as a number, date, datetime, or timeofday), or an array. If it's an array,
101
     * it should have a v property for the tick value, and an optional f property containing the literal string to be
102
     * displayed as the label. Examples :
103
     * [5,10,15,20]
104
     * [ ['v' => 32, 'f' => 'thirty two'], ['v' => 64, 'f' => 'sixty four'] ] ]
105
     * [16, ['v' => 32, 'f' => 'thirty two'], ['v' => 64, 'f' => 'sixty four'], 128] ]
106
     *
107
     * @var array
108
     */
109
    protected $ticks;
110
111
    /**
112
     * vAxis property that specifies a title for the vertical axis.
113
     *
114
     * @var string
115
     */
116
    protected $title;
117
118
    /**
119
     * @var TitleTextStyle
120
     */
121
    protected $titleTextStyle;
122
123
    /**
124
     * Moves the max value of the vertical axis to the specified value; this will be upward in most charts.
125
     * Ignored if this is set to a value smaller than the maximum y-value of the data. vAxis.viewWindow.max
126
     * overrides this property.
127
     *
128
     * @var int
129
     */
130
    protected $maxValue;
131
132
    /**
133
     * Moves the min value of the vertical axis to the specified value; this will be downward in most charts.
134
     * Ignored if this is set to a value greater than the minimum y-value of the data. vAxis.viewWindow.min
135
     * overrides this property.
136
     *
137
     * @var int
138
     */
139
    protected $minValue;
140
141
    /**
142
     * Specifies how to scale the vertical axis to render the values within the chart area. The following string
143
     * values are supported:
144
     * 'pretty' - Scale the vertical values so that the maximum and minimum data values are rendered a bit inside the
145
     *   top and bottom of the chart area. This will cause vaxis.viewWindow.min and vaxis.viewWindow.max to be ignored.
146
     * 'maximized' - Scale the vertical values so that the maximum and minimum data values touch the top and bottom
147
     *   of the chart area. This will cause vaxis.viewWindow.min and vaxis.viewWindow.max to be ignored.
148
     * 'explicit' - A deprecated option for specifying the top and bottom scale values of the chart area.
149
     *   (Deprecated because it's redundant with vaxis.viewWindow.min and vaxis.viewWindow.max. Data values outside
150
     *   these values will be cropped. You must specify a vAxis.viewWindow object describing the maximum and minimum
151
     *   values to show.
152
     *
153
     * @var string
154
     */
155
    protected $viewWindowMode;
156
157
    /**
158
     * @var ViewWindow
159
     */
160
    protected $viewWindow;
161
162
163
    /**
164
     * VAxis constructor.
165
     */
166 View Code Duplication
    public function __construct()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
167
    {
168
        $this->gridlines = new Gridlines();
169
        $this->minorGridlines = new MinorGridlines();
170
        $this->titleTextStyle = new TitleTextStyle();
171
        $this->viewWindow = new ViewWindow();
172
        $this->textStyle = new MediumTextStyle();
173
    }
174
175
    /**
176
     * @return Gridlines
177
     */
178
    public function getGridlines()
179
    {
180
        return $this->gridlines;
181
    }
182
183
    /**
184
     * @return MinorGridlines
185
     */
186
    public function getMinorGridlines()
187
    {
188
        return $this->minorGridlines;
189
    }
190
191
    /**
192
     * @return TitleTextStyle
193
     */
194
    public function getTitleTextStyle()
195
    {
196
        return $this->titleTextStyle;
197
    }
198
199
    /**
200
     * @return ViewWindow
201
     */
202
    public function getViewWindow()
203
    {
204
        return $this->viewWindow;
205
    }
206
207
    /**
208
     * @return MediumTextStyle
209
     */
210
    public function getTextStyle()
211
    {
212
        return $this->textStyle;
213
    }
214
215
    /**
216
     * @param int $baseline
217
     *
218
     * @return $this
219
     */
220
    public function setBaseline($baseline)
221
    {
222
        $this->baseline = $baseline;
223
224
        return $this;
225
    }
226
227
    /**
228
     * @param string $baselineColor
229
     *
230
     * @return $this
231
     */
232
    public function setBaselineColor($baselineColor)
233
    {
234
        $this->baselineColor = $baselineColor;
235
236
        return $this;
237
    }
238
239
    /**
240
     * @param int $direction
241
     *
242
     * @return $this
243
     */
244
    public function setDirection($direction)
245
    {
246
        $this->direction = $direction;
247
248
        return $this;
249
    }
250
251
    /**
252
     * @param string $format
253
     *
254
     * @return $this
255
     */
256
    public function setFormat($format)
257
    {
258
        $this->format = $format;
259
260
        return $this;
261
    }
262
263
    /**
264
     * @param boolean $logScale
265
     *
266
     * @return $this
267
     */
268
    public function setLogScale($logScale)
269
    {
270
        $this->logScale = $logScale;
271
272
        return $this;
273
    }
274
275
    /**
276
     * @param string $scaleType
277
     *
278
     * @return $this
279
     */
280
    public function setScaleType($scaleType)
281
    {
282
        $this->scaleType = $scaleType;
283
284
        return $this;
285
    }
286
287
    /**
288
     * @param string $textPosition
289
     *
290
     * @return $this
291
     */
292
    public function setTextPosition($textPosition)
293
    {
294
        $this->textPosition = $textPosition;
295
296
        return $this;
297
    }
298
299
    /**
300
     * @param array $ticks
301
     *
302
     * @return $this
303
     */
304
    public function setTicks($ticks)
305
    {
306
        $this->ticks = $ticks;
307
308
        return $this;
309
    }
310
311
    /**
312
     * @param string $title
313
     *
314
     * @return $this
315
     */
316
    public function setTitle($title)
317
    {
318
        $this->title = $title;
319
320
        return $this;
321
    }
322
323
    /**
324
     * @param int $maxValue
325
     *
326
     * @return $this
327
     */
328
    public function setMaxValue($maxValue)
329
    {
330
        $this->maxValue = $maxValue;
331
332
        return $this;
333
    }
334
335
    /**
336
     * @param int $minValue
337
     *
338
     * @return $this
339
     */
340
    public function setMinValue($minValue)
341
    {
342
        $this->minValue = $minValue;
343
344
        return $this;
345
    }
346
347
    /**
348
     * @param string $viewWindowMode
349
     *
350
     * @return $this
351
     */
352
    public function setViewWindowMode($viewWindowMode)
353
    {
354
        $this->viewWindowMode = $viewWindowMode;
355
356
        return $this;
357
    }
358
}
359