1 | <?php
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Aqua Theme class
|
---|
5 | */
|
---|
6 | class AquaTheme extends Theme
|
---|
7 | {
|
---|
8 | protected $font_color = '#0044CC';
|
---|
9 | protected $background_color = '#DDFFFF';
|
---|
10 | protected $axis_color = '#0066CC';
|
---|
11 | protected $grid_color = '#3366CC';
|
---|
12 |
|
---|
13 | function GetColorList() {
|
---|
14 | return array(
|
---|
15 | '#183152',
|
---|
16 | '#C4D7ED',
|
---|
17 | '#375D81',
|
---|
18 | '#ABC8E2',
|
---|
19 | '#E1E6FA',
|
---|
20 | '#9BBAB2',
|
---|
21 | '#3B4259',
|
---|
22 | '#0063BC',
|
---|
23 | '#1D5A73',
|
---|
24 | '#ABABFF',
|
---|
25 | '#27ADC5',
|
---|
26 | '#EDFFCC',
|
---|
27 |
|
---|
28 | /*
|
---|
29 |
|
---|
30 | '#66FFFF',
|
---|
31 | '#00AABB',
|
---|
32 | '#00FFCC',
|
---|
33 | '#33CCFF',
|
---|
34 | '#008866',
|
---|
35 | '#99FFFF',
|
---|
36 | '#0099FF',
|
---|
37 | '#99FFCC',
|
---|
38 | '#3399FF',
|
---|
39 | '#2277FF',
|
---|
40 | '#445588',
|
---|
41 | '#003388',
|
---|
42 | '#338877',
|
---|
43 | '#55DDFF',
|
---|
44 | '#00FF99',
|
---|
45 | '#BBBBBB',
|
---|
46 | '#77AAFF',
|
---|
47 | '#00FFCC',
|
---|
48 | */
|
---|
49 | );
|
---|
50 | }
|
---|
51 |
|
---|
52 | function SetupGraph($graph) {
|
---|
53 |
|
---|
54 | // graph
|
---|
55 | /*
|
---|
56 | $img = $graph->img;
|
---|
57 | $height = $img->height;
|
---|
58 | $graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
|
---|
59 | */
|
---|
60 | $graph->SetFrame(false);
|
---|
61 | $graph->SetMarginColor('white');
|
---|
62 | $graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
|
---|
63 |
|
---|
64 | // legend
|
---|
65 | $graph->legend->SetFrameWeight(0);
|
---|
66 | $graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
---|
67 | $graph->legend->SetFillColor('white');
|
---|
68 | $graph->legend->SetLayout(LEGEND_HOR);
|
---|
69 | $graph->legend->SetColumns(3);
|
---|
70 | $graph->legend->SetShadow(false);
|
---|
71 | $graph->legend->SetMarkAbsSize(5);
|
---|
72 |
|
---|
73 | // xaxis
|
---|
74 | $graph->xaxis->title->SetColor($this->font_color);
|
---|
75 | $graph->xaxis->SetColor($this->axis_color, $this->font_color);
|
---|
76 | $graph->xaxis->SetTickSide(SIDE_BOTTOM);
|
---|
77 | $graph->xaxis->SetLabelMargin(10);
|
---|
78 |
|
---|
79 | // yaxis
|
---|
80 | $graph->yaxis->title->SetColor($this->font_color);
|
---|
81 | $graph->yaxis->SetColor($this->axis_color, $this->font_color);
|
---|
82 | $graph->yaxis->SetTickSide(SIDE_LEFT);
|
---|
83 | $graph->yaxis->SetLabelMargin(8);
|
---|
84 | $graph->yaxis->HideLine();
|
---|
85 | $graph->yaxis->HideTicks();
|
---|
86 | $graph->xaxis->SetTitleMargin(15);
|
---|
87 |
|
---|
88 | // grid
|
---|
89 | $graph->ygrid->SetColor($this->grid_color);
|
---|
90 | $graph->ygrid->SetLineStyle('dotted');
|
---|
91 |
|
---|
92 |
|
---|
93 | // font
|
---|
94 | $graph->title->SetColor($this->font_color);
|
---|
95 | $graph->subtitle->SetColor($this->font_color);
|
---|
96 | $graph->subsubtitle->SetColor($this->font_color);
|
---|
97 |
|
---|
98 | // $graph->img->SetAntiAliasing();
|
---|
99 | }
|
---|
100 |
|
---|
101 |
|
---|
102 | function SetupPieGraph($graph) {
|
---|
103 |
|
---|
104 | // graph
|
---|
105 | $graph->SetFrame(false);
|
---|
106 |
|
---|
107 | // legend
|
---|
108 | $graph->legend->SetFillColor('white');
|
---|
109 |
|
---|
110 | $graph->legend->SetFrameWeight(0);
|
---|
111 | $graph->legend->Pos(0.5, 0.80, 'center', 'top');
|
---|
112 | $graph->legend->SetLayout(LEGEND_HOR);
|
---|
113 | $graph->legend->SetColumns(4);
|
---|
114 |
|
---|
115 | $graph->legend->SetShadow(false);
|
---|
116 | $graph->legend->SetMarkAbsSize(5);
|
---|
117 |
|
---|
118 | // title
|
---|
119 | $graph->title->SetColor($this->font_color);
|
---|
120 | $graph->subtitle->SetColor($this->font_color);
|
---|
121 | $graph->subsubtitle->SetColor($this->font_color);
|
---|
122 |
|
---|
123 | $graph->SetAntiAliasing();
|
---|
124 | }
|
---|
125 |
|
---|
126 |
|
---|
127 | function PreStrokeApply($graph) {
|
---|
128 | if ($graph->legend->HasItems()) {
|
---|
129 | $img = $graph->img;
|
---|
130 | $graph->SetMargin(
|
---|
131 | $img->raw_left_margin,
|
---|
132 | $img->raw_right_margin,
|
---|
133 | $img->raw_top_margin,
|
---|
134 | is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
|
---|
135 | );
|
---|
136 | }
|
---|
137 | }
|
---|
138 |
|
---|
139 | function ApplyPlot($plot) {
|
---|
140 |
|
---|
141 | switch (get_class($plot))
|
---|
142 | {
|
---|
143 | case 'GroupBarPlot':
|
---|
144 | {
|
---|
145 | foreach ($plot->plots as $_plot) {
|
---|
146 | $this->ApplyPlot($_plot);
|
---|
147 | }
|
---|
148 | break;
|
---|
149 | }
|
---|
150 |
|
---|
151 | case 'AccBarPlot':
|
---|
152 | {
|
---|
153 | foreach ($plot->plots as $_plot) {
|
---|
154 | $this->ApplyPlot($_plot);
|
---|
155 | }
|
---|
156 | break;
|
---|
157 | }
|
---|
158 |
|
---|
159 | case 'BarPlot':
|
---|
160 | {
|
---|
161 | $plot->Clear();
|
---|
162 |
|
---|
163 | $color = $this->GetNextColor();
|
---|
164 | $plot->SetColor($color);
|
---|
165 | $plot->SetFillColor($color);
|
---|
166 | //$plot->SetShadow();
|
---|
167 | break;
|
---|
168 | }
|
---|
169 |
|
---|
170 | case 'LinePlot':
|
---|
171 | {
|
---|
172 | $plot->Clear();
|
---|
173 | $plot->SetColor($this->GetNextColor());
|
---|
174 | $plot->SetWeight(2);
|
---|
175 | // $plot->SetBarCenter();
|
---|
176 | break;
|
---|
177 | }
|
---|
178 |
|
---|
179 | case 'PiePlot':
|
---|
180 | {
|
---|
181 | $plot->SetCenter(0.5, 0.45);
|
---|
182 | $plot->ShowBorder(false);
|
---|
183 | $plot->SetSliceColors($this->GetThemeColors());
|
---|
184 | break;
|
---|
185 | }
|
---|
186 |
|
---|
187 | case 'PiePlot3D':
|
---|
188 | {
|
---|
189 | $plot->SetSliceColors($this->GetThemeColors());
|
---|
190 | break;
|
---|
191 | }
|
---|
192 |
|
---|
193 | default:
|
---|
194 | {
|
---|
195 | }
|
---|
196 | }
|
---|
197 | }
|
---|
198 | }
|
---|
199 |
|
---|
200 |
|
---|
201 | ?>
|
---|