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