source: trunk/client/modules/Elezioni/grafici/themes/RoseTheme.class.php@ 388

Last change on this file since 388 was 266, checked in by roby, 6 years ago
File size: 4.8 KB
RevLine 
[266]1<?php
2
3/**
4* Rose Theme class
5*/
6class RoseTheme extends Theme
7{
8 private $font_color = '#CC0044';
9 private $background_color = '#FFDDDD';
10 private $axis_color = '#CC0000';
11 private $grid_color = '#CC3333';
12
13 function GetColorList() {
14 return array(
15 '#FF0000',
16 '#FF99FF',
17 '#AA0099',
18 '#FF00FF',
19 '#FF6666',
20 '#FF0099',
21 '#FFBB88',
22 '#AA2211',
23 '#FF6699',
24 '#BBAA88',
25 '#FF2200',
26 '#883333',
27 '#EE7777',
28 '#EE7711',
29 '#FF0066',
30 '#DD7711',
31 '#AA6600',
32 '#EE5500',
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.