source: trunk/client/modules/Elezioni/grafici/themes/VividTheme.class.php@ 398

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