Explorer   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 119
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 19
c 0
b 0
f 0
dl 0
loc 119
ccs 18
cts 18
cp 1
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setActions() 0 5 1
A setMaxZoomIn() 0 5 1
A setZoomDelta() 0 5 1
A setKeepInBounds() 0 5 1
A setAxis() 0 5 1
A setMaxZoomOut() 0 5 1
1
<?php
2
3
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options;
4
5
/**
6
 * The explorer option allows users to pan and zoom Google charts. explorer: {} provides the default explorer behavior,
7
 * enabling users to pan horizontally and vertically by dragging, and to zoom in and out by scrolling.
8
 * This feature is experimental and may change in future releases.
9
 *
10
 * @author Christophe Meneses
11
 */
12
class Explorer
13
{
14
    /**
15
     * The Google Charts explorer supports three actions :
16
     *   dragToPan: Drag to pan around the chart horizontally and vertically. To pan only along the horizontal axis,
17
     *     use explorer: { axis: 'horizontal' }. Similarly for the vertical axis.
18
     *   dragToZoom: The explorer's default behavior is to zoom in and out when the user scrolls. If explorer :
19
     *     { actions: ['dragToZoom', 'rightClickToReset'] } is used, dragging across a rectangular area zooms into
20
     *     that area. We recommend using rightClickToReset whenever dragToZoom is used. See explorer.maxZoomIn,
21
     *     explorer.maxZoomOut, and explorer.zoomDelta for zoom customizations.
22
     *   rightClickToReset: Right clicking on the chart returns it to the original pan and zoom level.
23
     *
24
     * @var string[]
25
     */
26
    protected $actions;
27
28
    /**
29
     * By default, users can pan both horizontally and vertically when the explorer option is used. If you want to
30
     * users to only pan horizontally, use explorer: { axis: 'horizontal' }. Similarly, explorer: { axis: 'vertical' }
31
     * enables vertical-only panning.
32
     *
33
     * @var string
34
     */
35
    protected $axis;
36
37
    /**
38
     * By default, users can pan all around, regardless of where the data is. To ensure that users don't pan beyond
39
     * the original chart, set keepInBounds true.
40
     *
41
     * @var bool
42
     */
43
    protected $keepInBounds;
44
45
    /**
46
     * The maximum that the explorer can zoom in. By default, users will be able to zoom in enough that they'll see
47
     * only 25% of the original view. Setting explorer maxZoomIn .5 would let users zoom in only far enough to
48
     * see half of the original view.
49
     *
50
     * @var float
51
     */
52
    protected $maxZoomIn;
53
54
    /**
55
     * The maximum that the explorer can zoom out. By default, users will be able to zoom out far enough that the
56
     * chart will take up only 1/4 of the available space. Setting explorer maxZoomOut 8 would let users zoom out far
57
     * enough that the chart would take up only 1/8 of the available space.
58
     *
59
     * @var float
60
     */
61
    protected $maxZoomOut;
62
63
    /**
64
     * When users zoom in or out, explorer.zoomDelta determines how much they zoom by. The smaller the number, the
65
     * smoother and slower the zoom.
66
     *
67
     * @var float
68
     */
69
    protected $zoomDelta;
70
71
    /**
72
     * @param string[] $actions
73
     *
74
     * @return $this
75
     */
76 2
    public function setActions(array $actions)
77
    {
78 2
        $this->actions = $actions;
79
80 2
        return $this;
81
    }
82
83
    /**
84
     * @return $this
85
     */
86 2
    public function setAxis(string $axis)
87
    {
88 2
        $this->axis = $axis;
89
90 2
        return $this;
91
    }
92
93
    /**
94
     * @return $this
95
     */
96 2
    public function setKeepInBounds(bool $keepInBounds)
97
    {
98 2
        $this->keepInBounds = $keepInBounds;
99
100 2
        return $this;
101
    }
102
103
    /**
104
     * @return $this
105
     */
106 2
    public function setMaxZoomIn(float $maxZoomIn)
107
    {
108 2
        $this->maxZoomIn = $maxZoomIn;
109
110 2
        return $this;
111
    }
112
113
    /**
114
     * @return $this
115
     */
116 2
    public function setMaxZoomOut(float $maxZoomOut)
117
    {
118 2
        $this->maxZoomOut = $maxZoomOut;
119
120 2
        return $this;
121
    }
122
123
    /**
124
     * @return $this
125
     */
126 2
    public function setZoomDelta(float $zoomDelta)
127
    {
128 2
        $this->zoomDelta = $zoomDelta;
129
130 2
        return $this;
131
    }
132
}
133