source: trunk/xgraph/jpgraph/themes/OceanTheme.class.php@ 42

Last change on this file since 42 was 42, checked in by marrucho, 11 years ago
File size: 4.8 KB
Line 
1<?php
2
3/**
4* Ocean Theme class
5*/
6class OceanTheme extends Theme
7{
8 protected $font_color = '#0066FF';
9 private $background_color = '#DDEEFF';
10 private $axis_color = '#0000CC';
11 private $grid_color = '#3333CC';
12
13 function GetColorList() {
14 return array(
15 '#0066FF',
16 '#CCCCFF',
17 '#0000FF',
18 '#3366FF',
19 '#33CCFF',
20 '#660088',
21 '#3300FF',
22 '#0099FF',
23 '#6633FF',
24 '#0055EE',
25 '#2277EE',
26 '#3300FF',
27 '#AA00EE',
28 '#778899',
29 '#114499',
30 '#7744EE',
31 '#002288',
32 '#6666FF',
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 $height = $img->height;
115 $graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
116 }
117 }
118
119 function ApplyPlot($plot) {
120
121 switch (get_class($plot))
122 {
123 case 'GroupBarPlot':
124 {
125 foreach ($plot->plots as $_plot) {
126 $this->ApplyPlot($_plot);
127 }
128 break;
129 }
130
131 case 'AccBarPlot':
132 {
133 foreach ($plot->plots as $_plot) {
134 $this->ApplyPlot($_plot);
135 }
136 break;
137 }
138
139 case 'BarPlot':
140 {
141 $plot->Clear();
142
143 $color = $this->GetNextColor();
144 $plot->SetColor($color);
145 $plot->SetFillColor($color);
146 $plot->SetShadow('red', 3, 4, false);
147 break;
148 }
149
150 case 'LinePlot':
151 {
152 $plot->Clear();
153
154 $plot->SetColor($this->GetNextColor());
155 $plot->SetWeight(2);
156 break;
157 }
158
159 case 'PiePlot':
160 {
161 $plot->ShowBorder(false);
162 $plot->SetSliceColors($this->GetThemeColors());
163 break;
164 }
165
166 case 'PiePlot3D':
167 {
168 $plot->SetSliceColors($this->GetThemeColors());
169 break;
170 }
171
172 default:
173 {
174 }
175 }
176 }
177}
178
179
180?>
Note: See TracBrowser for help on using the repository browser.