1 | <?php
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Green Theme class
|
---|
5 | */
|
---|
6 | class GreenTheme extends Theme
|
---|
7 | {
|
---|
8 | private $font_color = '#009900';
|
---|
9 | private $background_color = '#EEFFDD';
|
---|
10 | private $axis_color = '#00CC00';
|
---|
11 | private $grid_color = '#33CC33';
|
---|
12 |
|
---|
13 | function GetColorList() {
|
---|
14 | return array(
|
---|
15 | '#66CC00',
|
---|
16 | '#009900',
|
---|
17 | '#AAFF77',
|
---|
18 | '#559922',
|
---|
19 | '#00CC33',
|
---|
20 | '#99FF00',
|
---|
21 | '#009966',
|
---|
22 | '#00FF99',
|
---|
23 | '#99BB66',
|
---|
24 | '#33FF00',
|
---|
25 | '#DDFFBB',
|
---|
26 | '#669933',
|
---|
27 | '#BBDDCC',
|
---|
28 | '#77CCBB',
|
---|
29 | '#668833',
|
---|
30 | '#BBEE66',
|
---|
31 | );
|
---|
32 | }
|
---|
33 |
|
---|
34 | function SetupGraph($graph) {
|
---|
35 |
|
---|
36 | // graph
|
---|
37 | /*
|
---|
38 | $img = $graph->img;
|
---|
39 | $height = $img->height;
|
---|
40 | $graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
|
---|
41 | */
|
---|
42 | $graph->SetFrame(false);
|
---|
43 | $graph->SetMarginColor('white');
|
---|
44 | $graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
|
---|
45 |
|
---|
46 | // legend
|
---|
47 | $graph->legend->SetFrameWeight(0);
|
---|
48 | $graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
---|
49 | $graph->legend->SetFillColor('white');
|
---|
50 | $graph->legend->SetLayout(LEGEND_HOR);
|
---|
51 | $graph->legend->SetColumns(3);
|
---|
52 | $graph->legend->SetShadow(false);
|
---|
53 | $graph->legend->SetMarkAbsSize(5);
|
---|
54 |
|
---|
55 | // xaxis
|
---|
56 | $graph->xaxis->title->SetColor($this->font_color);
|
---|
57 | $graph->xaxis->SetColor($this->axis_color, $this->font_color);
|
---|
58 | $graph->xaxis->SetTickSide(SIDE_BOTTOM);
|
---|
59 | $graph->xaxis->SetLabelMargin(10);
|
---|
60 |
|
---|
61 | // yaxis
|
---|
62 | $graph->yaxis->title->SetColor($this->font_color);
|
---|
63 | $graph->yaxis->SetColor($this->axis_color, $this->font_color);
|
---|
64 | $graph->yaxis->SetTickSide(SIDE_LEFT);
|
---|
65 | $graph->yaxis->SetLabelMargin(8);
|
---|
66 | $graph->yaxis->HideLine();
|
---|
67 | $graph->yaxis->HideTicks();
|
---|
68 | $graph->xaxis->SetTitleMargin(15);
|
---|
69 |
|
---|
70 | // grid
|
---|
71 | $graph->ygrid->SetColor($this->grid_color);
|
---|
72 | $graph->ygrid->SetLineStyle('dotted');
|
---|
73 |
|
---|
74 |
|
---|
75 | // font
|
---|
76 | $graph->title->SetColor($this->font_color);
|
---|
77 | $graph->subtitle->SetColor($this->font_color);
|
---|
78 | $graph->subsubtitle->SetColor($this->font_color);
|
---|
79 |
|
---|
80 | // $graph->img->SetAntiAliasing();
|
---|
81 | }
|
---|
82 |
|
---|
83 |
|
---|
84 | function SetupPieGraph($graph) {
|
---|
85 |
|
---|
86 | // graph
|
---|
87 | $graph->SetFrame(false);
|
---|
88 |
|
---|
89 | // legend
|
---|
90 | $graph->legend->SetFillColor('white');
|
---|
91 | /*
|
---|
92 | $graph->legend->SetFrameWeight(0);
|
---|
93 | $graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
---|
94 | $graph->legend->SetLayout(LEGEND_HOR);
|
---|
95 | $graph->legend->SetColumns(3);
|
---|
96 | */
|
---|
97 | $graph->legend->SetShadow(false);
|
---|
98 | $graph->legend->SetMarkAbsSize(5);
|
---|
99 |
|
---|
100 | // title
|
---|
101 | $graph->title->SetColor($this->font_color);
|
---|
102 | $graph->subtitle->SetColor($this->font_color);
|
---|
103 | $graph->subsubtitle->SetColor($this->font_color);
|
---|
104 |
|
---|
105 | $graph->SetAntiAliasing();
|
---|
106 | }
|
---|
107 |
|
---|
108 |
|
---|
109 | function PreStrokeApply($graph) {
|
---|
110 | if ($graph->legend->HasItems()) {
|
---|
111 | $img = $graph->img;
|
---|
112 | $graph->SetMargin(
|
---|
113 | $img->raw_left_margin,
|
---|
114 | $img->raw_right_margin,
|
---|
115 | $img->raw_top_margin,
|
---|
116 | is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
|
---|
117 | );
|
---|
118 | }
|
---|
119 | }
|
---|
120 |
|
---|
121 | function ApplyPlot($plot) {
|
---|
122 |
|
---|
123 | switch (get_class($plot))
|
---|
124 | {
|
---|
125 | case 'GroupBarPlot':
|
---|
126 | {
|
---|
127 | foreach ($plot->plots as $_plot) {
|
---|
128 | $this->ApplyPlot($_plot);
|
---|
129 | }
|
---|
130 | break;
|
---|
131 | }
|
---|
132 |
|
---|
133 | case 'AccBarPlot':
|
---|
134 | {
|
---|
135 | foreach ($plot->plots as $_plot) {
|
---|
136 | $this->ApplyPlot($_plot);
|
---|
137 | }
|
---|
138 | break;
|
---|
139 | }
|
---|
140 |
|
---|
141 | case 'BarPlot':
|
---|
142 | {
|
---|
143 | $plot->Clear();
|
---|
144 |
|
---|
145 | $color = $this->GetNextColor();
|
---|
146 | $plot->SetColor($color);
|
---|
147 | $plot->SetFillColor($color);
|
---|
148 | $plot->SetShadow('red', 3, 4, false);
|
---|
149 | break;
|
---|
150 | }
|
---|
151 |
|
---|
152 | case 'LinePlot':
|
---|
153 | {
|
---|
154 | $plot->Clear();
|
---|
155 |
|
---|
156 | $plot->SetColor($this->GetNextColor().'@0.4');
|
---|
157 | $plot->SetWeight(2);
|
---|
158 | break;
|
---|
159 | }
|
---|
160 |
|
---|
161 | case 'PiePlot':
|
---|
162 | {
|
---|
163 | $plot->ShowBorder(false);
|
---|
164 | $plot->SetSliceColors($this->GetThemeColors());
|
---|
165 | break;
|
---|
166 | }
|
---|
167 |
|
---|
168 | case 'PiePlot3D':
|
---|
169 | {
|
---|
170 | $plot->SetSliceColors($this->GetThemeColors());
|
---|
171 | break;
|
---|
172 | }
|
---|
173 |
|
---|
174 | default:
|
---|
175 | {
|
---|
176 | }
|
---|
177 | }
|
---|
178 | }
|
---|
179 | }
|
---|
180 |
|
---|
181 |
|
---|
182 | ?>
|
---|