Test Failed
Push — master ( e6b57e...dd7c2d )
by Christophe
07:44
created

PieChartOptions::setInterpolateNulls()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
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
    /**
19
     * If true, displays a three-dimensional chart.
20
     *
21
     * @var bool
22
     */
23
    protected $is3D;
24
25
    /**
26
     * @var AdvancedLegend
27
     */
28
    protected $legend;
29
30
    /**
31
     * If between 0 and 1, displays a donut chart. The hole with have a radius equal to number times the radius of the
32
     * chart.
33
     *
34
     * @var float
35
     */
36
    protected $pieHole;
37
38
    /**
39
     * Color for the combination slice that holds all slices below sliceVisibilityThreshold.
40
     *
41
     * @var string
42
     */
43
    protected $pieResidueSliceColor;
44
45
    /**
46
     * A label for the combination slice that holds all slices below sliceVisibilityThreshold.
47
     *
48
     * @var string
49
     */
50
    protected $pieResidueSliceLabel;
51
52
    /**
53
     * The content of the text displayed on the slice. Can be one of the following :
54
     * 'percentage' - The percentage of the slice size out of the total.
55
     * 'value' - The quantitative value of the slice.
56
     * 'label' - The name of the slice.
57
     * 'none' - No text is displayed.
58
     *
59
     * @var string
60
     */
61
    protected $pieSliceText;
62
63
    /**
64
     * An object that specifies the slice text style.
65
     *
66
     * @var PieSliceTextStyle
67
     */
68
    protected $pieSliceTextStyle;
69
70
    /**
71
     * The angle, in degrees, to rotate the chart by. The default of 0 will orient the leftmost edge of the first
72
     * slice directly up.
73
     *
74
     * @var int
75
     */
76
    protected $pieStartAngle;
77
78
    use ReverseCategoriesTrait;
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
    /**
109
     * PieChartOptions constructor.
110
     */
111
    public function __construct()
112
    {
113
        parent::__construct();
114
115
        $this->legend = new AdvancedLegend();
116
        $this->pieSliceTextStyle = new PieSliceTextStyle();
117
        $this->tooltip = new FullTooltip();
118
    }
119
120
    /**
121
     * @return PieSliceTextStyle
122
     */
123
    public function getPieSliceTextStyle()
124
    {
125
        return $this->pieSliceTextStyle;
126
    }
127
128
    /**
129
     * @return FullTooltip
130
     */
131
    public function getTooltip()
132
    {
133
        return $this->tooltip;
134
    }
135
136
    /**
137
     * @return AdvancedLegend
138
     */
139
    public function getLegend()
140
    {
141
        return $this->legend;
142
    }
143
144
    /**
145
     * @param bool $is3D
146
     *
147
     * @return $this
148
     */
149
    public function setIs3D($is3D)
150
    {
151
        $this->is3D = $is3D;
152
153
        return $this;
154
    }
155
156
    /**
157
     * @param float $pieHole
158
     *
159
     * @return $this
160
     */
161
    public function setPieHole($pieHole)
162
    {
163
        $this->pieHole = $pieHole;
164
165
        return $this;
166
    }
167
168
    /**
169
     * @param int $pieStartAngle
170
     *
171
     * @return $this
172
     */
173
    public function setPieStartAngle($pieStartAngle)
174
    {
175
        $this->pieStartAngle = $pieStartAngle;
176
177
        return $this;
178
    }
179
180
    /**
181
     * @param string $pieSliceText
182
     *
183
     * @return $this
184
     */
185
    public function setPieSliceText($pieSliceText)
186
    {
187
        $this->pieSliceText = $pieSliceText;
188
189
        return $this;
190
    }
191
192
    /**
193
     * @param PieSlice[] $slices
194
     *
195
     * @return $this
196
     */
197
    public function setSlices($slices)
198
    {
199
        $this->slices = $slices;
200
201
        return $this;
202
    }
203
204
    /**
205
     * @param float $sliceVisibilityThreshold
206
     *
207
     * @return $this
208
     */
209
    public function setSliceVisibilityThreshold($sliceVisibilityThreshold)
210
    {
211
        $this->sliceVisibilityThreshold = $sliceVisibilityThreshold;
212
213
        return $this;
214
    }
215
216
    /**
217
     * @param string $pieResidueSliceColor
218
     *
219
     * @return $this
220
     */
221
    public function setPieResidueSliceColor($pieResidueSliceColor)
222
    {
223
        $this->pieResidueSliceColor = $pieResidueSliceColor;
224
225
        return $this;
226
    }
227
228
    /**
229
     * @param string $pieResidueSliceLabel
230
     *
231
     * @return $this
232
     */
233
    public function setPieResidueSliceLabel($pieResidueSliceLabel)
234
    {
235
        $this->pieResidueSliceLabel = $pieResidueSliceLabel;
236
237
        return $this;
238
    }
239
}
240