|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* @author Christophe Meneses |
|
7
|
|
|
*/ |
|
8
|
|
|
class Legend |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* Alignment of the legend. Can be one of the following : |
|
12
|
|
|
* 'start' - Aligned to the start of the area allocated for the legend. |
|
13
|
|
|
* 'center' - Centered in the area allocated for the legend. |
|
14
|
|
|
* 'end' - Aligned to the end of the area allocated for the legend. |
|
15
|
|
|
* |
|
16
|
|
|
* Start, center, and end are relative to the style -- vertical or horizontal -- of the legend. For example, in a |
|
17
|
|
|
* 'right' legend, 'start' and 'end' are at the top and bottom, respectively; for a 'top' legend, 'start' and 'end' |
|
18
|
|
|
* would be at the left and right of the area, respectively. |
|
19
|
|
|
* The default value depends on the legend's position. For 'bottom' legends, the default is 'center'; other legends |
|
20
|
|
|
* default to 'start'. |
|
21
|
|
|
* |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $alignment; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Position of the legend. Can be one of the following : |
|
28
|
|
|
* 'bottom' - Displays the legend below the chart. |
|
29
|
|
|
* 'labeled' - Draws lines connecting slices to their data values. |
|
30
|
|
|
* 'left' - Displays the legend left of the chart. |
|
31
|
|
|
* 'none' - Displays no legend. |
|
32
|
|
|
* 'right' - Displays the legend right of the chart. |
|
33
|
|
|
* 'top' - Displays the legend above the chart. |
|
34
|
|
|
* |
|
35
|
|
|
* @var string |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $position; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var MediumTextStyle |
|
41
|
|
|
*/ |
|
42
|
|
|
protected $textStyle; |
|
43
|
|
|
|
|
44
|
11 |
|
public function __construct() |
|
45
|
|
|
{ |
|
46
|
11 |
|
$this->textStyle = new MediumTextStyle(); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
2 |
|
public function getTextStyle(): MediumTextStyle |
|
50
|
|
|
{ |
|
51
|
2 |
|
return $this->textStyle; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @return $this |
|
56
|
|
|
*/ |
|
57
|
2 |
|
public function setAlignment(string $alignment) |
|
58
|
|
|
{ |
|
59
|
2 |
|
$this->alignment = $alignment; |
|
60
|
|
|
|
|
61
|
2 |
|
return $this; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return $this |
|
66
|
|
|
*/ |
|
67
|
2 |
|
public function setPosition(string $position) |
|
68
|
|
|
{ |
|
69
|
2 |
|
$this->position = $position; |
|
70
|
|
|
|
|
71
|
2 |
|
return $this; |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|