IsStackedTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 40
ccs 3
cts 3
cp 1
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A setIsStacked() 0 5 1
1
<?php
2
3
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options;
4
5
/**
6
 * @author Christophe Meneses
7
 */
8
trait IsStackedTrait
9
{
10
    /**
11
     * If set to true, stacks the elements for all series at each domain value. The isStacked option also supports
12
     * 100% stacking, where the stacks of elements at each domain value are rescaled to add up to 100%.
13
     *
14
     * The options for isStacked are:
15
     * false — elements will not stack. This is the default option.
16
     * true — stacks elements for all series at each domain value.
17
     * 'percent' — stacks elements for all series at each domain value and rescales them such that they add up to
18
     * 100%, with each element's value calculated as a percentage of 100%.
19
     * 'relative' — stacks elements for all series at each domain value and rescales them such that they add up to 1,
20
     * with each element's value calculated as a fraction of 1.
21
     * 'absolute' — functions the same as isStacked: true.
22
     *
23
     * For 100% stacking, the calculated value for each element will appear in the tooltip after its actual value.
24
     * The target axis will default to tick values based on the relative 0-1 scale as fractions of 1 for 'relative',
25
     * and 0-100% for 'percent' (Note: when using the 'percent' option, the axis/tick values are displayed as
26
     * percentages, however the actual values are the relative 0-1 scale values. This is because the percentage axis
27
     * ticks are the result of applying a format of "#.##%" to the relative 0-1 scale values. When using isStacked :
28
     * 'percent', be sure to specify any ticks/gridlines using the relative 0-1 scale values). You can customize the
29
     * gridlines/tick values and formatting using the appropriate hAxis/vAxis options.
30
     * 100% stacking only supports data values of type number, and must have a baseline of zero.
31
     *
32
     * Default: false
33
     *
34
     * @var bool|string
35
     */
36
    protected $isStacked;
37
38
    /**
39
     * @param bool|string $isStacked
40
     *
41
     * @return $this
42
     */
43 1
    public function setIsStacked($isStacked)
44
    {
45 1
        $this->isStacked = $isStacked;
46
47 1
        return $this;
48
    }
49
}
50