1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options\ColumnChart; |
4
|
|
|
|
5
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\AdvancedAnimation; |
6
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\AdvancedAnnotations; |
7
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\AdvancedChartOptions; |
8
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\AdvancedHAxis; |
9
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\AdvancedTooltip; |
10
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\Bar; |
11
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\Explorer; |
12
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\Legend; |
13
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\Trendlines; |
14
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\VAxis; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @author Christophe Meneses |
18
|
|
|
*/ |
19
|
|
View Code Duplication |
class ColumnChartOptions extends AdvancedChartOptions |
|
|
|
|
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @var AdvancedAnimation |
23
|
|
|
*/ |
24
|
|
|
protected $animation; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var AdvancedAnnotations |
28
|
|
|
*/ |
29
|
|
|
protected $annotations; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var Bar |
33
|
|
|
*/ |
34
|
|
|
protected $bar; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* The transparency of data points, with 1.0 being completely opaque and 0.0 fully transparent. In scatter, |
38
|
|
|
* histogram, bar, and column charts, this refers to the visible data: dots in the scatter chart and rectangles |
39
|
|
|
* in the others. In charts where selecting data creates a dot, such as the line and area charts, this refers to |
40
|
|
|
* the circles that appear upon hover or selection. The combo chart exhibits both behaviors, and this option has |
41
|
|
|
* no effect on other charts. (To change the opacity of a trendline, see |
42
|
|
|
* {@link https://developers.google.com/chart/interactive/docs/gallery/trendlines#Example4}) |
43
|
|
|
* |
44
|
|
|
* @var float |
45
|
|
|
*/ |
46
|
|
|
protected $dataOpacity; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var Explorer |
50
|
|
|
*/ |
51
|
|
|
protected $explorer; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* The type of the entity that receives focus on mouse hover. Also affects which entity is selected by mouse |
55
|
|
|
* click, and which data table element is associated with events. Can be one of the following : |
56
|
|
|
* 'datum' - Focus on a single data point. Correlates to a cell in the data table. |
57
|
|
|
* 'category' - Focus on a grouping of all data points along the major axis. Correlates to a row in the data table. |
58
|
|
|
* |
59
|
|
|
* In focusTarget 'category' the tooltip displays all the category values. This may be useful for comparing values |
60
|
|
|
* of different series. |
61
|
|
|
* |
62
|
|
|
* @var string |
63
|
|
|
*/ |
64
|
|
|
protected $focusTarget; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var AdvancedHAxis |
68
|
|
|
*/ |
69
|
|
|
protected $hAxis; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* If set to true, stacks the elements for all series at each domain value. The isStacked option also supports |
73
|
|
|
* 100% stacking, where the stacks of elements at each domain value are rescaled to add up to 100%. |
74
|
|
|
* |
75
|
|
|
* The options for isStacked are: |
76
|
|
|
* false — elements will not stack. This is the default option. |
77
|
|
|
* true — stacks elements for all series at each domain value. |
78
|
|
|
* 'percent' — stacks elements for all series at each domain value and rescales them such that they add up to |
79
|
|
|
* 100%, with each element's value calculated as a percentage of 100%. |
80
|
|
|
* 'relative' — stacks elements for all series at each domain value and rescales them such that they add up to 1, |
81
|
|
|
* with each element's value calculated as a fraction of 1. |
82
|
|
|
* 'absolute' — functions the same as isStacked: true. |
83
|
|
|
* |
84
|
|
|
* For 100% stacking, the calculated value for each element will appear in the tooltip after its actual value. |
85
|
|
|
* The target axis will default to tick values based on the relative 0-1 scale as fractions of 1 for 'relative', |
86
|
|
|
* and 0-100% for 'percent' (Note: when using the 'percent' option, the axis/tick values are displayed as |
87
|
|
|
* percentages, however the actual values are the relative 0-1 scale values. This is because the percentage axis |
88
|
|
|
* ticks are the result of applying a format of "#.##%" to the relative 0-1 scale values. When using isStacked : |
89
|
|
|
* 'percent', be sure to specify any ticks/gridlines using the relative 0-1 scale values). You can customize the |
90
|
|
|
* gridlines/tick values and formatting using the appropriate hAxis/vAxis options. |
91
|
|
|
* 100% stacking only supports data values of type number, and must have a baseline of zero. |
92
|
|
|
* |
93
|
|
|
* @var boolean|string |
94
|
|
|
*/ |
95
|
|
|
protected $isStacked; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @var Legend |
99
|
|
|
*/ |
100
|
|
|
protected $legend; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* The orientation of the chart. When set to 'vertical', rotates the axes of the chart. |
104
|
|
|
* |
105
|
|
|
* @var string |
106
|
|
|
*/ |
107
|
|
|
protected $orientation; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* If set to true, will draw series from right to left. The default is to draw left-to-right. |
111
|
|
|
* |
112
|
|
|
* @var boolean |
113
|
|
|
*/ |
114
|
|
|
protected $reverseCategories; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @var AdvancedTooltip |
118
|
|
|
*/ |
119
|
|
|
protected $tooltip; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Displays trendlines on the charts that support them. By default, linear trendlines are used, but this can be |
123
|
|
|
* customized with the trendlines.n.type option. |
124
|
|
|
* |
125
|
|
|
* @var Trendlines[] |
126
|
|
|
*/ |
127
|
|
|
protected $trendlines; |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Specifies properties for individual vertical axes, if the chart has multiple vertical axes. Each child object |
131
|
|
|
* is a VAxis object, and can contain all the properties supported by vAxis. These property values override any |
132
|
|
|
* global settings for the same property. |
133
|
|
|
* To specify a chart with multiple vertical axes, first define a new axis using series.targetAxisIndex, then |
134
|
|
|
* configure the axis using vAxes. |
135
|
|
|
* |
136
|
|
|
* @var VAxis[] |
137
|
|
|
*/ |
138
|
|
|
protected $vAxes; |
139
|
|
|
|
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* ColumnChartOptions constructor. |
143
|
|
|
*/ |
144
|
|
|
public function __construct() |
145
|
|
|
{ |
146
|
|
|
parent::__construct(); |
147
|
|
|
|
148
|
|
|
$this->animation = new AdvancedAnimation(); |
149
|
|
|
$this->annotations = new AdvancedAnnotations(); |
150
|
|
|
$this->bar = new Bar(); |
151
|
|
|
$this->explorer = new Explorer(); |
152
|
|
|
$this->hAxis = new AdvancedHAxis(); |
153
|
|
|
$this->legend = new Legend(); |
154
|
|
|
$this->tooltip = new AdvancedTooltip(); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @return AdvancedAnimation |
160
|
|
|
*/ |
161
|
|
|
public function getAnimation() |
162
|
|
|
{ |
163
|
|
|
return $this->animation; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @return AdvancedAnnotations |
168
|
|
|
*/ |
169
|
|
|
public function getAnnotations() |
170
|
|
|
{ |
171
|
|
|
return $this->annotations; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @return Bar |
176
|
|
|
*/ |
177
|
|
|
public function getBar() |
178
|
|
|
{ |
179
|
|
|
return $this->bar; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @return Explorer |
184
|
|
|
*/ |
185
|
|
|
public function getExplorer() |
186
|
|
|
{ |
187
|
|
|
return $this->explorer; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @return AdvancedHAxis |
192
|
|
|
*/ |
193
|
|
|
public function getHAxis() |
194
|
|
|
{ |
195
|
|
|
return $this->hAxis; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* @return Legend |
200
|
|
|
*/ |
201
|
|
|
public function getLegend() |
202
|
|
|
{ |
203
|
|
|
return $this->legend; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* @return AdvancedTooltip |
208
|
|
|
*/ |
209
|
|
|
public function getTooltip() |
210
|
|
|
{ |
211
|
|
|
return $this->tooltip; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* @param float $dataOpacity |
216
|
|
|
* |
217
|
|
|
* @return $this |
218
|
|
|
*/ |
219
|
|
|
public function setDataOpacity($dataOpacity) |
220
|
|
|
{ |
221
|
|
|
$this->dataOpacity = $dataOpacity; |
222
|
|
|
|
223
|
|
|
return $this; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* @param string $focusTarget |
228
|
|
|
* |
229
|
|
|
* @return $this |
230
|
|
|
*/ |
231
|
|
|
public function setFocusTarget($focusTarget) |
232
|
|
|
{ |
233
|
|
|
$this->focusTarget = $focusTarget; |
234
|
|
|
|
235
|
|
|
return $this; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* @param bool|string $isStacked |
240
|
|
|
* |
241
|
|
|
* @return $this |
242
|
|
|
*/ |
243
|
|
|
public function setIsStacked($isStacked) |
244
|
|
|
{ |
245
|
|
|
$this->isStacked = $isStacked; |
246
|
|
|
|
247
|
|
|
return $this; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* @param string $orientation |
252
|
|
|
* |
253
|
|
|
* @return $this |
254
|
|
|
*/ |
255
|
|
|
public function setOrientation($orientation) |
256
|
|
|
{ |
257
|
|
|
$this->orientation = $orientation; |
258
|
|
|
|
259
|
|
|
return $this; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* @param boolean $reverseCategories |
264
|
|
|
* |
265
|
|
|
* @return $this |
266
|
|
|
*/ |
267
|
|
|
public function setReverseCategories($reverseCategories) |
268
|
|
|
{ |
269
|
|
|
$this->reverseCategories = $reverseCategories; |
270
|
|
|
|
271
|
|
|
return $this; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* @param Trendlines[] $trendlines |
276
|
|
|
* |
277
|
|
|
* @return $this |
278
|
|
|
*/ |
279
|
|
|
public function setTrendlines($trendlines) |
280
|
|
|
{ |
281
|
|
|
$this->trendlines = $trendlines; |
282
|
|
|
|
283
|
|
|
return $this; |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* @param VAxis[] $vAxes |
288
|
|
|
* |
289
|
|
|
* @return $this |
290
|
|
|
*/ |
291
|
|
|
public function setVAxes($vAxes) |
292
|
|
|
{ |
293
|
|
|
$this->vAxes = $vAxes; |
294
|
|
|
|
295
|
|
|
return $this; |
296
|
|
|
} |
297
|
|
|
} |
298
|
|
|
|
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.