1 | <?php |
||
12 | class Highchart extends AbstractChart implements ChartInterface |
||
13 | { |
||
14 | public $colorAxis; |
||
15 | |||
16 | public $noData; |
||
17 | |||
18 | 33 | public function __construct() |
|
19 | { |
||
20 | 33 | parent::__construct(); |
|
21 | 33 | $this->initChartOption('colorAxis'); |
|
22 | 33 | $this->initChartOption('noData'); |
|
23 | 33 | } |
|
24 | |||
25 | /** |
||
26 | * @param string $engine |
||
27 | * |
||
28 | * @return string |
||
29 | */ |
||
30 | 32 | public function render($engine = 'jquery') |
|
31 | { |
||
32 | 32 | $chartJS = ""; |
|
33 | 32 | $chartJS .= $this->renderEngine($engine); |
|
34 | 32 | $chartJS .= $this->renderOptions(); |
|
35 | 32 | $chartJS .= "\n var " . (isset($this->chart->renderTo) ? $this->chart->renderTo : 'chart') . " = new Highcharts.Chart({\n"; |
|
36 | |||
37 | // Chart |
||
38 | 32 | $chartJS .= $this->renderWithJavascriptCallback($this->chart->chart, "chart"); |
|
39 | |||
40 | // Colors |
||
41 | 32 | $chartJS .= $this->renderColors(); |
|
42 | |||
43 | // Color Axis |
||
44 | 32 | $chartJS .= $this->renderColorAxis(); |
|
45 | |||
46 | // Credits |
||
47 | 32 | $chartJS .= $this->renderCredits(); |
|
48 | |||
49 | // Exporting |
||
50 | 32 | $chartJS .= $this->renderWithJavascriptCallback($this->exporting->exporting, "exporting"); |
|
51 | |||
52 | // Labels |
||
53 | |||
54 | // Legend |
||
55 | 32 | $chartJS .= $this->renderWithJavascriptCallback($this->legend->legend, "legend"); |
|
56 | |||
57 | // Loading |
||
58 | // Navigation |
||
59 | |||
60 | // noData |
||
61 | 32 | $chartJS .= $this->renderWithJavascriptCallback($this->noData->noData, "noData"); |
|
62 | |||
63 | // Pane |
||
64 | 32 | $chartJS .= $this->renderPane(); |
|
65 | |||
66 | // PlotOptions |
||
67 | 32 | $chartJS .= $this->renderWithJavascriptCallback($this->plotOptions->plotOptions, "plotOptions"); |
|
68 | |||
69 | // Series |
||
70 | 32 | $chartJS .= $this->renderWithJavascriptCallback($this->series, "series"); |
|
71 | |||
72 | // Scrollbar |
||
73 | 32 | $chartJS .= $this->renderScrollbar(); |
|
74 | |||
75 | // Drilldown |
||
76 | 32 | $chartJS .= $this->renderDrilldown(); |
|
77 | |||
78 | // Subtitle |
||
79 | 32 | $chartJS .= $this->renderSubtitle(); |
|
80 | |||
81 | // Symbols |
||
82 | |||
83 | // Title |
||
84 | 32 | $chartJS .= $this->renderTitle(); |
|
85 | |||
86 | // Tooltip |
||
87 | 32 | $chartJS .= $this->renderWithJavascriptCallback($this->tooltip->tooltip, "tooltip"); |
|
88 | |||
89 | // xAxis |
||
90 | 32 | $chartJS .= $this->renderXAxis(); |
|
91 | |||
92 | // yAxis |
||
93 | 32 | $chartJS .= $this->renderYAxis(); |
|
94 | |||
95 | // trim last trailing comma and close parenthesis |
||
96 | 32 | $chartJS = rtrim($chartJS, ",\n") . "\n });\n"; |
|
97 | |||
98 | 32 | if ($engine !== false) { |
|
99 | 32 | $chartJS .= "});\n"; |
|
100 | 32 | } |
|
101 | |||
102 | 32 | return trim($chartJS); |
|
103 | } |
||
104 | |||
105 | /** |
||
106 | * @return string |
||
107 | */ |
||
108 | 32 | private function renderColorAxis() |
|
118 | |||
119 | /** |
||
120 | * @return string |
||
121 | */ |
||
122 | 32 | private function renderPane() |
|
130 | |||
131 | /** |
||
132 | * @return string |
||
133 | */ |
||
134 | 32 | private function renderDrilldown() |
|
142 | } |
||
143 |