source: trunk/xgraph/jpgraph/themes/GreenTheme.class.php

Last change on this file was 42, checked in by marrucho, 11 years ago
File size: 4.8 KB
Line 
1<?php
2
3/**
4* Green Theme class
5*/
6class 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 $height = $img->height;
113 $graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
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
152 $plot->SetColor($this->GetNextColor().'@0.4');
153 $plot->SetWeight(2);
154 break;
155 }
156
157 case 'PiePlot':
158 {
159 $plot->ShowBorder(false);
160 $plot->SetSliceColors($this->GetThemeColors());
161 break;
162 }
163
164 case 'PiePlot3D':
165 {
166 $plot->SetSliceColors($this->GetThemeColors());
167 break;
168 }
169
170 default:
171 {
172 }
173 }
174 }
175}
176
177
178?>
Note: See TracBrowser for help on using the repository browser.