|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options\TreeMapChart; |
|
4
|
|
|
|
|
5
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\ChartOptions; |
|
6
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\FontSizeTrait; |
|
7
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\MediumTextStyle; |
|
8
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\TitleTextStyle; |
|
9
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\TitleTrait; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* @author Christophe Meneses |
|
13
|
|
|
*/ |
|
14
|
|
|
class TreeMapChartOptions extends ChartOptions |
|
15
|
|
|
{ |
|
16
|
|
|
use FontSizeTrait; |
|
17
|
|
|
|
|
18
|
|
|
use TitleTrait; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* The text color. Specify an HTML color value. |
|
22
|
|
|
* |
|
23
|
|
|
* @var string |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $fontColor; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* The font family to use for all text. |
|
29
|
|
|
* |
|
30
|
|
|
* @var string |
|
31
|
|
|
*/ |
|
32
|
|
|
protected $fontFamily; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* The color of the header section for each node. Specify an HTML color value. |
|
36
|
|
|
* |
|
37
|
|
|
* @var string |
|
38
|
|
|
*/ |
|
39
|
|
|
protected $headerColor; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* The height of the header section for each node, in pixels (can be zero). |
|
43
|
|
|
* |
|
44
|
|
|
* @var int |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $headerHeight; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* The color of the header of a node being hovered over. Specify an HTML color value or null; if null this value |
|
50
|
|
|
* will be headerColor lightened by 35%. |
|
51
|
|
|
* |
|
52
|
|
|
* @var string |
|
53
|
|
|
*/ |
|
54
|
|
|
protected $headerHighlightColor; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Determines if elements should show highlighted effects when moused over. If set to true, highlighting for |
|
58
|
|
|
* different elements can be specified using the various highlightColor options. |
|
59
|
|
|
* |
|
60
|
|
|
* @var bool |
|
61
|
|
|
*/ |
|
62
|
|
|
protected $highlightOnMouseOver; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* When maxPostDepth is greater than 1, causing nodes below the current depth to be shown, hintOpacity specifies |
|
66
|
|
|
* how transparent it should be. It should be between 0 and 1; the higher the value, the fainter the node. |
|
67
|
|
|
* |
|
68
|
|
|
* @var float |
|
69
|
|
|
*/ |
|
70
|
|
|
protected $hintOpacity; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* The color for a rectangle with a column 3 value of maxColorValue. Specify an HTML color value. |
|
74
|
|
|
* |
|
75
|
|
|
* @var string |
|
76
|
|
|
*/ |
|
77
|
|
|
protected $maxColor; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* The maximum number of node levels to show in the current view. Levels will be flattened into the current plane. |
|
81
|
|
|
* If your tree has more levels than this, you will have to go up or down to see them. You can additionally see |
|
82
|
|
|
* maxPostDepth levels below this as shaded rectangles within these nodes. |
|
83
|
|
|
* |
|
84
|
|
|
* @var int |
|
85
|
|
|
*/ |
|
86
|
|
|
protected $maxDepth; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* The highlight color to use for the node with the largest value in column 3. Specify an HTML color value or null; |
|
90
|
|
|
* If null, this value will be the value of maxColor lightened by 35%. |
|
91
|
|
|
* |
|
92
|
|
|
* @var string |
|
93
|
|
|
*/ |
|
94
|
|
|
protected $maxHighlightColor; |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* How many levels of nodes beyond maxDepth to show in "hinted" fashion. Hinted nodes are shown as shaded |
|
98
|
|
|
* rectangles within a node that is within the maxDepth limit. |
|
99
|
|
|
* |
|
100
|
|
|
* @var int |
|
101
|
|
|
*/ |
|
102
|
|
|
protected $maxPostDepth; |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* The maximum value allowed in column 3. All values greater than this will be trimmed to this value. If set to |
|
106
|
|
|
* null, it will be set to the max value in the column. |
|
107
|
|
|
* |
|
108
|
|
|
* @var int |
|
109
|
|
|
*/ |
|
110
|
|
|
protected $maxColorValue; |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* The color for a rectangle with a column 3 value midway between maxColorValue and minColorValue. Specify an HTML |
|
114
|
|
|
* color value. |
|
115
|
|
|
* |
|
116
|
|
|
* @var string |
|
117
|
|
|
*/ |
|
118
|
|
|
protected $midColor; |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* The highlight color to use for the node with a column 3 value near the median of minColorValue and maxColorValue. |
|
122
|
|
|
* Specify an HTML color value or null; if null, this value will be the value of midColor lightened by 35%. |
|
123
|
|
|
* |
|
124
|
|
|
* @var string |
|
125
|
|
|
*/ |
|
126
|
|
|
protected $midHighlightColor; |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* The color for a rectangle with the column 3 value of minColorValue. Specify an HTML color value. |
|
130
|
|
|
* |
|
131
|
|
|
* @var string |
|
132
|
|
|
*/ |
|
133
|
|
|
protected $minColor; |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* The highlight color to use for the node with a column 3 value nearest to minColorValue. Specify an HTML color |
|
137
|
|
|
* value or null; if null, this value will be the value of minColor lightened by 35%. |
|
138
|
|
|
* |
|
139
|
|
|
* @var string |
|
140
|
|
|
*/ |
|
141
|
|
|
protected $minHighlightColor; |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* The minimum value allowed in column 3. All values less than this will be trimmed to this value. If set to null, |
|
145
|
|
|
* it will be calculated as the minimum value in the column. |
|
146
|
|
|
* |
|
147
|
|
|
* @var int |
|
148
|
|
|
*/ |
|
149
|
|
|
protected $minColorValue; |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* The color to use for a rectangle when a node has no value for column 3, and that node is a leaf (or contains |
|
153
|
|
|
* only leaves). Specify an HTML color value. |
|
154
|
|
|
* |
|
155
|
|
|
* @var string |
|
156
|
|
|
*/ |
|
157
|
|
|
protected $noColor; |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* The color to use for a rectangle of "no" color when highlighted. Specify an HTML color value or null; if null, |
|
161
|
|
|
* this will be the value of noColor lightened by 35%. |
|
162
|
|
|
* |
|
163
|
|
|
* @var string |
|
164
|
|
|
*/ |
|
165
|
|
|
protected $noHighlightColor; |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* Whether or not to show a color gradient scale from minColor to maxColor along the top of the chart. Specify |
|
169
|
|
|
* true to show the scale. |
|
170
|
|
|
* |
|
171
|
|
|
* @var bool |
|
172
|
|
|
*/ |
|
173
|
|
|
protected $showScale; |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* Whether to show tooltips. |
|
177
|
|
|
* |
|
178
|
|
|
* @var bool |
|
179
|
|
|
*/ |
|
180
|
|
|
protected $showTooltips; |
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* @var MediumTextStyle |
|
184
|
|
|
*/ |
|
185
|
|
|
protected $textStyle; |
|
186
|
|
|
|
|
187
|
|
|
/** |
|
188
|
|
|
* @var TitleTextStyle |
|
189
|
|
|
*/ |
|
190
|
|
|
protected $titleTextStyle; |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* Whether to use weighted averages for aggregation. |
|
194
|
|
|
* |
|
195
|
|
|
* @var bool |
|
196
|
|
|
*/ |
|
197
|
|
|
protected $useWeightedAverageForAggregation; |
|
198
|
|
|
|
|
199
|
1 |
|
public function __construct() |
|
200
|
|
|
{ |
|
201
|
1 |
|
parent::__construct(); |
|
202
|
|
|
|
|
203
|
1 |
|
$this->textStyle = new MediumTextStyle(); |
|
204
|
1 |
|
$this->titleTextStyle = new TitleTextStyle(); |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
public function getTextStyle(): MediumTextStyle |
|
208
|
|
|
{ |
|
209
|
|
|
return $this->textStyle; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
public function getTitleTextStyle(): TitleTextStyle |
|
213
|
|
|
{ |
|
214
|
|
|
return $this->titleTextStyle; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
/** |
|
218
|
|
|
* @return $this |
|
219
|
|
|
*/ |
|
220
|
|
|
public function setUseWeightedAverageForAggregation(bool $useWeightedAverageForAggregation) |
|
221
|
|
|
{ |
|
222
|
|
|
$this->useWeightedAverageForAggregation = $useWeightedAverageForAggregation; |
|
223
|
|
|
|
|
224
|
|
|
return $this; |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
/** |
|
228
|
|
|
* @return $this |
|
229
|
|
|
*/ |
|
230
|
|
|
public function setFontColor(string $fontColor) |
|
231
|
|
|
{ |
|
232
|
|
|
$this->fontColor = $fontColor; |
|
233
|
|
|
|
|
234
|
|
|
return $this; |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
/** |
|
238
|
|
|
* @return $this |
|
239
|
|
|
*/ |
|
240
|
|
|
public function setFontFamily(string $fontFamily) |
|
241
|
|
|
{ |
|
242
|
|
|
$this->fontFamily = $fontFamily; |
|
243
|
|
|
|
|
244
|
|
|
return $this; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* @return $this |
|
249
|
|
|
*/ |
|
250
|
|
|
public function setHeaderColor(string $headerColor) |
|
251
|
|
|
{ |
|
252
|
|
|
$this->headerColor = $headerColor; |
|
253
|
|
|
|
|
254
|
|
|
return $this; |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
/** |
|
258
|
|
|
* @return $this |
|
259
|
|
|
*/ |
|
260
|
|
|
public function setHeaderHeight(int $headerHeight) |
|
261
|
|
|
{ |
|
262
|
|
|
$this->headerHeight = $headerHeight; |
|
263
|
|
|
|
|
264
|
|
|
return $this; |
|
265
|
|
|
} |
|
266
|
|
|
|
|
267
|
|
|
/** |
|
268
|
|
|
* @return $this |
|
269
|
|
|
*/ |
|
270
|
|
|
public function setHeaderHighlightColor(string $headerHighlightColor) |
|
271
|
|
|
{ |
|
272
|
|
|
$this->headerHighlightColor = $headerHighlightColor; |
|
273
|
|
|
|
|
274
|
|
|
return $this; |
|
275
|
|
|
} |
|
276
|
|
|
|
|
277
|
|
|
/** |
|
278
|
|
|
* @return $this |
|
279
|
|
|
*/ |
|
280
|
|
|
public function setHighlightOnMouseOver(bool $highlightOnMouseOver) |
|
281
|
|
|
{ |
|
282
|
|
|
$this->highlightOnMouseOver = $highlightOnMouseOver; |
|
283
|
|
|
|
|
284
|
|
|
return $this; |
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
/** |
|
288
|
|
|
* @return $this |
|
289
|
|
|
*/ |
|
290
|
|
|
public function setHintOpacity(float $hintOpacity) |
|
291
|
|
|
{ |
|
292
|
|
|
$this->hintOpacity = $hintOpacity; |
|
293
|
|
|
|
|
294
|
|
|
return $this; |
|
295
|
|
|
} |
|
296
|
|
|
|
|
297
|
|
|
/** |
|
298
|
|
|
* @return $this |
|
299
|
|
|
*/ |
|
300
|
|
|
public function setMaxColor(string $maxColor) |
|
301
|
|
|
{ |
|
302
|
|
|
$this->maxColor = $maxColor; |
|
303
|
|
|
|
|
304
|
|
|
return $this; |
|
305
|
|
|
} |
|
306
|
|
|
|
|
307
|
|
|
/** |
|
308
|
|
|
* @return $this |
|
309
|
|
|
*/ |
|
310
|
|
|
public function setMaxDepth(int $maxDepth) |
|
311
|
|
|
{ |
|
312
|
|
|
$this->maxDepth = $maxDepth; |
|
313
|
|
|
|
|
314
|
|
|
return $this; |
|
315
|
|
|
} |
|
316
|
|
|
|
|
317
|
|
|
/** |
|
318
|
|
|
* @return $this |
|
319
|
|
|
*/ |
|
320
|
|
|
public function setMaxHighlightColor(string $maxHighlightColor) |
|
321
|
|
|
{ |
|
322
|
|
|
$this->maxHighlightColor = $maxHighlightColor; |
|
323
|
|
|
|
|
324
|
|
|
return $this; |
|
325
|
|
|
} |
|
326
|
|
|
|
|
327
|
|
|
/** |
|
328
|
|
|
* @return $this |
|
329
|
|
|
*/ |
|
330
|
|
|
public function setMaxPostDepth(int $maxPostDepth) |
|
331
|
|
|
{ |
|
332
|
|
|
$this->maxPostDepth = $maxPostDepth; |
|
333
|
|
|
|
|
334
|
|
|
return $this; |
|
335
|
|
|
} |
|
336
|
|
|
|
|
337
|
|
|
/** |
|
338
|
|
|
* @return $this |
|
339
|
|
|
*/ |
|
340
|
|
|
public function setMaxColorValue(int $maxColorValue) |
|
341
|
|
|
{ |
|
342
|
|
|
$this->maxColorValue = $maxColorValue; |
|
343
|
|
|
|
|
344
|
|
|
return $this; |
|
345
|
|
|
} |
|
346
|
|
|
|
|
347
|
|
|
/** |
|
348
|
|
|
* @return $this |
|
349
|
|
|
*/ |
|
350
|
|
|
public function setMidColor(string $midColor) |
|
351
|
|
|
{ |
|
352
|
|
|
$this->midColor = $midColor; |
|
353
|
|
|
|
|
354
|
|
|
return $this; |
|
355
|
|
|
} |
|
356
|
|
|
|
|
357
|
|
|
/** |
|
358
|
|
|
* @return $this |
|
359
|
|
|
*/ |
|
360
|
|
|
public function setMidHighlightColor(string $midHighlightColor) |
|
361
|
|
|
{ |
|
362
|
|
|
$this->midHighlightColor = $midHighlightColor; |
|
363
|
|
|
|
|
364
|
|
|
return $this; |
|
365
|
|
|
} |
|
366
|
|
|
|
|
367
|
|
|
/** |
|
368
|
|
|
* @return $this |
|
369
|
|
|
*/ |
|
370
|
|
|
public function setMinColor(string $minColor) |
|
371
|
|
|
{ |
|
372
|
|
|
$this->minColor = $minColor; |
|
373
|
|
|
|
|
374
|
|
|
return $this; |
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
/** |
|
378
|
|
|
* @return $this |
|
379
|
|
|
*/ |
|
380
|
|
|
public function setMinHighlightColor(string $minHighlightColor) |
|
381
|
|
|
{ |
|
382
|
|
|
$this->minHighlightColor = $minHighlightColor; |
|
383
|
|
|
|
|
384
|
|
|
return $this; |
|
385
|
|
|
} |
|
386
|
|
|
|
|
387
|
|
|
/** |
|
388
|
|
|
* @return $this |
|
389
|
|
|
*/ |
|
390
|
|
|
public function setMinColorValue(int $minColorValue) |
|
391
|
|
|
{ |
|
392
|
|
|
$this->minColorValue = $minColorValue; |
|
393
|
|
|
|
|
394
|
|
|
return $this; |
|
395
|
|
|
} |
|
396
|
|
|
|
|
397
|
|
|
/** |
|
398
|
|
|
* @return $this |
|
399
|
|
|
*/ |
|
400
|
|
|
public function setNoColor(string $noColor) |
|
401
|
|
|
{ |
|
402
|
|
|
$this->noColor = $noColor; |
|
403
|
|
|
|
|
404
|
|
|
return $this; |
|
405
|
|
|
} |
|
406
|
|
|
|
|
407
|
|
|
/** |
|
408
|
|
|
* @return $this |
|
409
|
|
|
*/ |
|
410
|
|
|
public function setNoHighlightColor(string $noHighlightColor) |
|
411
|
|
|
{ |
|
412
|
|
|
$this->noHighlightColor = $noHighlightColor; |
|
413
|
|
|
|
|
414
|
|
|
return $this; |
|
415
|
|
|
} |
|
416
|
|
|
|
|
417
|
|
|
/** |
|
418
|
|
|
* @return $this |
|
419
|
|
|
*/ |
|
420
|
|
|
public function setShowScale(bool $showScale) |
|
421
|
|
|
{ |
|
422
|
|
|
$this->showScale = $showScale; |
|
423
|
|
|
|
|
424
|
|
|
return $this; |
|
425
|
|
|
} |
|
426
|
|
|
|
|
427
|
|
|
/** |
|
428
|
|
|
* @return $this |
|
429
|
|
|
*/ |
|
430
|
|
|
public function setShowTooltips(bool $showTooltips) |
|
431
|
|
|
{ |
|
432
|
|
|
$this->showTooltips = $showTooltips; |
|
433
|
|
|
|
|
434
|
|
|
return $this; |
|
435
|
|
|
} |
|
436
|
|
|
} |
|
437
|
|
|
|