source: trunk/client/modules/Elezioni/grafici/themes/OrangeTheme.class.php@ 266

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