source: trunk/client/modules/Elezioni/grafici/themes/SoftyTheme.class.php@ 404

Last change on this file since 404 was 266, checked in by roby, 6 years ago
File size: 5.5 KB
RevLine 
[266]1<?php
2
3/**
4* Softy Theme class
5*/
6class SoftyTheme extends Theme
7{
8 protected $font_color = '#000000';
9 protected $background_color = '#F7F8F4';
10 protected $axis_color = '#000000';
11 protected $grid_color = '#CCCCCC';
12
13 function GetColorList() {
14 return array(
15 '#CFE7FB',
16 '#F9D76F',
17 '#B9D566',
18 '#FFBB90',
19 '#66BBBB',
20 '#E69090',
21 '#BB90BB',
22 '#9AB67C',
23 '#D1CC66',
24
25/*
26
27 '#AFD8F8',
28 '#F6BD0F',
29 '#8BBA00',
30 '#FF8E46',
31 '#008E8E',
32
33 '#D64646',
34 '#8E468E',
35 '#588526',
36 '#B3AA00',
37 '#008ED6',
38
39 '#9D080D',
40 '#A186BE',
41 */
42 );
43 }
44
45 function SetupGraph($graph) {
46
47 // graph
48 $graph->SetFrame(false);
49 $graph->SetMarginColor('white');
50
51 // legend
52 $graph->legend->SetFrameWeight(0);
53 $graph->legend->Pos(0.5, 0.85, 'center', 'top');
54 $graph->legend->SetFillColor('white');
55 $graph->legend->SetLayout(LEGEND_HOR);
56 $graph->legend->SetColumns(3);
57 $graph->legend->SetShadow(false);
58 $graph->legend->SetMarkAbsSize(5);
59
60 // xaxis
61 $graph->xaxis->title->SetColor($this->font_color);
62 $graph->xaxis->SetColor($this->axis_color, $this->font_color);
63 $graph->xaxis->SetTickSide(SIDE_BOTTOM);
64 $graph->xaxis->SetLabelMargin(10);
65
66 // yaxis
67 $graph->yaxis->title->SetColor($this->font_color);
68 $graph->yaxis->SetColor($this->axis_color, $this->font_color);
69 $graph->yaxis->SetTickSide(SIDE_LEFT);
70 $graph->yaxis->SetLabelMargin(8);
71 $graph->yaxis->HideLine();
72 $graph->yaxis->HideTicks();
73 $graph->xaxis->SetTitleMargin(15);
74
75 // y2~
76 if (isset($graph->y2axis)) {
77 $graph->y2axis->title->SetColor($this->font_color);
78 $graph->y2axis->SetColor($this->axis_color, $this->font_color);
79 $graph->y2axis->SetTickSide(SIDE_LEFT);
80 $graph->y2axis->SetLabelMargin(8);
81 $graph->y2axis->HideLine();
82 $graph->y2axis->HideTicks();
83 }
84
85 // yn
86 if (isset($graph->y2axis)) {
87 foreach ($graph->ynaxis as $axis) {
88 $axis->title->SetColor($this->font_color);
89 $axis->SetColor($this->axis_color, $this->font_color);
90 $axis->SetTickSide(SIDE_LEFT);
91 $axis->SetLabelMargin(8);
92 $axis->HideLine();
93 $axis->HideTicks();
94 }
95 }
96
97 // grid
98 $graph->ygrid->SetColor($this->grid_color);
99 $graph->ygrid->SetLineStyle('dotted');
100 $graph->ygrid->SetFill(true, '#FFFFFF', $this->background_color);
101 $graph->xgrid->Show();
102 $graph->xgrid->SetColor($this->grid_color);
103 $graph->xgrid->SetLineStyle('dotted');
104
105
106 // font
107 $graph->title->SetColor($this->font_color);
108 $graph->subtitle->SetColor($this->font_color);
109 $graph->subsubtitle->SetColor($this->font_color);
110
111// $graph->img->SetAntiAliasing();
112 }
113
114
115 function SetupPieGraph($graph) {
116
117 // graph
118 $graph->SetFrame(false);
119
120 // title
121 $graph->title->SetColor($this->font_color);
122 $graph->subtitle->SetColor($this->font_color);
123 $graph->subsubtitle->SetColor($this->font_color);
124
125 $graph->SetAntiAliasing();
126 }
127
128
129 function PreStrokeApply($graph) {
130 if ($graph->legend->HasItems()) {
131 $img = $graph->img;
132 $graph->SetMargin(
133 $img->raw_left_margin,
134 $img->raw_right_margin,
135 $img->raw_top_margin,
136 is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
137 );
138 }
139 }
140
141 function ApplyPlot($plot) {
142
143 switch (get_class($plot))
144 {
145 case 'BarPlot':
146 {
147 $plot->Clear();
148
149 $color = $this->GetNextColor();
150 $plot->SetColor($color);
151 $plot->SetFillColor($color);
152 $plot->SetShadow('red', 3, 4, false);
153 $plot->value->SetAlign('center', 'center');
154 break;
155 }
156
157 case 'LinePlot':
158 {
159 $plot->Clear();
160
161 $plot->SetColor($this->GetNextColor());
162 $plot->SetWeight(2);
163// $plot->SetBarCenter();
164 break;
165 }
166
167 case 'PiePlot':
168 {
169 $plot->ShowBorder(false);
170 $plot->SetSliceColors($this->GetThemeColors());
171 break;
172 }
173
174
175 case 'GroupBarPlot':
176 {
177 foreach ($plot->plots as $_plot) {
178 $this->ApplyPlot($_plot);
179 }
180 break;
181 }
182
183 case 'AccBarPlot':
184 {
185 $plot->value->SetAlign('center', 'center');
186 foreach ($plot->plots as $_plot) {
187 $this->ApplyPlot($_plot);
188 $_plot->SetValuePos('center');
189 }
190 break;
191 }
192
193 case 'ScatterPlot':
194 {
195 break;
196 }
197
198
199 case 'PiePlot3D':
200 {
201 $plot->SetSliceColors($this->GetThemeColors());
202 break;
203 }
204
205 default:
206 {
207 }
208 }
209 }
210}
211
212
213?>
Note: See TracBrowser for help on using the repository browser.