1 | <?php |
||
7 | abstract class AbstractChart |
||
8 | { |
||
9 | // Default options |
||
10 | public $chart; |
||
11 | public $colors; |
||
12 | public $credits; |
||
13 | public $global; |
||
14 | public $labels; |
||
15 | public $lang; |
||
16 | public $legend; |
||
17 | public $loading; |
||
18 | public $plotOptions; |
||
19 | public $rangeSelector; |
||
20 | public $point; |
||
21 | public $series; |
||
22 | public $drilldown; |
||
23 | public $subtitle; |
||
24 | public $symbols; |
||
25 | public $title; |
||
26 | public $tooltip; |
||
27 | public $xAxis; |
||
28 | public $yAxis; |
||
29 | public $exporting; |
||
30 | public $navigation; |
||
31 | public $pane; |
||
32 | public $scrollbar; |
||
33 | |||
34 | 69 | public function __construct() |
|
35 | { |
||
36 | 69 | $chartOptions = array('chart', 'credits', 'global', 'labels', 'lang', 'legend', 'loading', 'plotOptions', |
|
37 | 69 | 'rangeSelector', 'point', 'subtitle', 'title', 'tooltip', 'xAxis', 'yAxis', 'pane', 'exporting', |
|
38 | 69 | 'navigation', 'drilldown', 'scrollbar'); |
|
39 | |||
40 | 69 | foreach ($chartOptions as $option) { |
|
41 | 69 | $this->initChartOption($option); |
|
42 | 69 | } |
|
43 | |||
44 | 69 | $arrayOptions = array('colors', 'series', 'symbols'); |
|
45 | |||
46 | 69 | foreach ($arrayOptions as $option) { |
|
47 | 69 | $this->initArrayOption($option); |
|
48 | 69 | } |
|
49 | 69 | } |
|
50 | |||
51 | abstract public function render(); |
||
52 | |||
53 | /** |
||
54 | * @param string $name |
||
55 | * @param mixed $value |
||
56 | * |
||
57 | * @return $this |
||
58 | */ |
||
59 | 3 | public function __call($name, $value) |
|
60 | { |
||
61 | 3 | $this->$name = $value; |
|
62 | |||
63 | 3 | return $this; |
|
64 | } |
||
65 | |||
66 | /** |
||
67 | * @param string $name |
||
68 | */ |
||
69 | 69 | protected function initChartOption($name) |
|
73 | |||
74 | /** |
||
75 | * @param string $name |
||
76 | */ |
||
77 | 69 | protected function initArrayOption($name) |
|
81 | |||
82 | /** |
||
83 | * @param ChartOption|array $chartOption |
||
84 | * @param string $name |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | 67 | protected function renderWithJavascriptCallback($chartOption, $name) |
|
102 | |||
103 | /** |
||
104 | * @param array $chartOption |
||
105 | * @param string $name |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | 67 | protected function renderArrayWithCallback($chartOption, $name) |
|
120 | |||
121 | /** |
||
122 | * @param ChartOption $chartOption |
||
123 | * @param string $name |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | 67 | protected function renderObjectWithCallback($chartOption, $name) |
|
138 | |||
139 | /** |
||
140 | * @param string $engine |
||
141 | * |
||
142 | * @return string |
||
143 | */ |
||
144 | 67 | protected function renderEngine($engine) |
|
152 | |||
153 | /** |
||
154 | * @return string |
||
155 | */ |
||
156 | 67 | protected function renderColors() |
|
164 | |||
165 | /** |
||
166 | * @return string |
||
167 | */ |
||
168 | 67 | protected function renderCredits() |
|
176 | |||
177 | /** |
||
178 | * @return string |
||
179 | */ |
||
180 | 67 | protected function renderSubtitle() |
|
188 | |||
189 | /** |
||
190 | * @return string |
||
191 | */ |
||
192 | 67 | protected function renderTitle() |
|
200 | |||
201 | /** |
||
202 | * @return string |
||
203 | */ |
||
204 | 67 | protected function renderXAxis() |
|
214 | |||
215 | /** |
||
216 | * @return string |
||
217 | */ |
||
218 | 67 | protected function renderYAxis() |
|
228 | |||
229 | /** |
||
230 | * @return string |
||
231 | */ |
||
232 | 67 | protected function renderOptions() |
|
245 | |||
246 | /** |
||
247 | * @return string |
||
248 | */ |
||
249 | 5 | protected function renderGlobal() |
|
257 | |||
258 | /** |
||
259 | * @return string |
||
260 | */ |
||
261 | 5 | protected function renderLang() |
|
269 | |||
270 | /** |
||
271 | * @return string |
||
272 | */ |
||
273 | 67 | protected function renderScrollbar() |
|
281 | } |
||
282 |