PieChartOptions::getPieSliceTextStyle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options\PieChart;
4
5
use CMEN\GoogleChartsBundle\GoogleCharts\Options\AdvancedLegend;
6
use CMEN\GoogleChartsBundle\GoogleCharts\Options\FullTooltip;
7
use CMEN\GoogleChartsBundle\GoogleCharts\Options\InterpolateNullsTrait;
8
use CMEN\GoogleChartsBundle\GoogleCharts\Options\MediumChartOptions;
9
use CMEN\GoogleChartsBundle\GoogleCharts\Options\ReverseCategoriesTrait;
10
11
/**
12
 * @author Christophe Meneses
13
 */
14
class PieChartOptions extends MediumChartOptions
15
{
16
    use InterpolateNullsTrait;
17
18
    use ReverseCategoriesTrait;
19
20
    /**
21
     * If true, displays a three-dimensional chart.
22
     *
23
     * @var bool
24
     */
25
    protected $is3D;
26
27
    /**
28
     * @var AdvancedLegend
29
     */
30
    protected $legend;
31
32
    /**
33
     * If between 0 and 1, displays a donut chart. The hole with have a radius equal to number times the radius of the
34
     * chart.
35
     *
36
     * @var float
37
     */
38
    protected $pieHole;
39
40
    /**
41
     * Color for the combination slice that holds all slices below sliceVisibilityThreshold.
42
     *
43
     * @var string
44
     */
45
    protected $pieResidueSliceColor;
46
47
    /**
48
     * A label for the combination slice that holds all slices below sliceVisibilityThreshold.
49
     *
50
     * @var string
51
     */
52
    protected $pieResidueSliceLabel;
53
54
    /**
55
     * The content of the text displayed on the slice. Can be one of the following :
56
     * 'percentage' - The percentage of the slice size out of the total.
57
     * 'value' - The quantitative value of the slice.
58
     * 'label' - The name of the slice.
59
     * 'none' - No text is displayed.
60
     *
61
     * @var string
62
     */
63
    protected $pieSliceText;
64
65
    /**
66
     * An object that specifies the slice text style.
67
     *
68
     * @var PieSliceTextStyle
69
     */
70
    protected $pieSliceTextStyle;
71
72
    /**
73
     * The angle, in degrees, to rotate the chart by. The default of 0 will orient the leftmost edge of the first
74
     * slice directly up.
75
     *
76
     * @var int
77
     */
78
    protected $pieStartAngle;
79
80
    /**
81
     * An array of Slice object, each describing the format of the corresponding slice in the pie. To use default values
82
     * for a slice, specify a null value. If a slice or a value is not specified, the global value will be used.
83
     *
84
     * You can specify either an array of Slice object, each of which applies to the slice in the order given, or you
85
     * can specify an array where each child has a numeric key indicating which slice it applies to. For example, the
86
     * following two declarations are identical :
87
     * [$slice1, null, $slice2]
88
     * [0 => $slice1, 2 => $slice2]
89
     *
90
     * @var PieSlice[]
91
     */
92
    protected $slices;
93
94
    /**
95
     * The fractional value of the pie, below which a slice will not show individually. All slices that have not
96
     * passed this threshold will be combined to a single "Other" slice, whose size is the sum of all their sizes.
97
     * Default is not to show individually any slice which is smaller than half a degree.
98
     *
99
     * @var float
100
     */
101
    protected $sliceVisibilityThreshold;
102
103
    /**
104
     * @var FullTooltip
105
     */
106
    protected $tooltip;
107
108
    public function __construct()
109
    {
110
        parent::__construct();
111
112
        $this->legend = new AdvancedLegend();
113
        $this->pieSliceTextStyle = new PieSliceTextStyle();
114
        $this->tooltip = new FullTooltip();
115
    }
116
117
    public function getPieSliceTextStyle(): PieSliceTextStyle
118
    {
119
        return $this->pieSliceTextStyle;
120
    }
121
122
    public function getTooltip(): FullTooltip
123
    {
124
        return $this->tooltip;
125
    }
126
127
    public function getLegend(): AdvancedLegend
128
    {
129
        return $this->legend;
130
    }
131
132
    /**
133
     * @return $this
134
     */
135
    public function setIs3D(bool $is3D)
136
    {
137
        $this->is3D = $is3D;
138
139
        return $this;
140
    }
141
142
    /**
143
     * @return $this
144
     */
145
    public function setPieHole(float $pieHole)
146
    {
147
        $this->pieHole = $pieHole;
148
149
        return $this;
150
    }
151
152
    /**
153
     * @return $this
154
     */
155
    public function setPieStartAngle(int $pieStartAngle)
156
    {
157
        $this->pieStartAngle = $pieStartAngle;
158
159
        return $this;
160
    }
161
162
    /**
163
     * @return $this
164
     */
165
    public function setPieSliceText(string $pieSliceText)
166
    {
167
        $this->pieSliceText = $pieSliceText;
168
169
        return $this;
170
    }
171
172
    /**
173
     * @param PieSlice[] $slices
174
     *
175
     * @return $this
176
     */
177
    public function setSlices(array $slices)
178
    {
179
        $this->slices = $slices;
180
181
        return $this;
182
    }
183
184
    /**
185
     * @return $this
186
     */
187
    public function setSliceVisibilityThreshold(float $sliceVisibilityThreshold)
188
    {
189
        $this->sliceVisibilityThreshold = $sliceVisibilityThreshold;
190
191
        return $this;
192
    }
193
194
    /**
195
     * @return $this
196
     */
197
    public function setPieResidueSliceColor(string $pieResidueSliceColor)
198
    {
199
        $this->pieResidueSliceColor = $pieResidueSliceColor;
200
201
        return $this;
202
    }
203
204
    /**
205
     * @return $this
206
     */
207
    public function setPieResidueSliceLabel(string $pieResidueSliceLabel)
208
    {
209
        $this->pieResidueSliceLabel = $pieResidueSliceLabel;
210
211
        return $this;
212
    }
213
}
214