Blame view

site/jpgraph/themes/AquaTheme.class.php 5.11 KB
8ec98c9f   Guillaume   MAJ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
  <?php
  
  /**
  * Aqua Theme class
  */
  class AquaTheme extends Theme 
  {
      protected $font_color       = '#0044CC';
      protected $background_color = '#DDFFFF';
      protected $axis_color       = '#0066CC';
      protected $grid_color       = '#3366CC';
  
      function GetColorList() {
          return array(
              '#183152',
              '#C4D7ED',
              '#375D81',
              '#ABC8E2',
              '#E1E6FA',
              '#9BBAB2',
              '#3B4259',
              '#0063BC',
              '#1D5A73',
              '#ABABFF',
              '#27ADC5',
              '#EDFFCC',
  
  /*
  
              '#66FFFF',
              '#00AABB',
              '#00FFCC',
              '#33CCFF',
              '#008866',
              '#99FFFF',
              '#0099FF',
              '#99FFCC',
              '#3399FF',
              '#2277FF',
              '#445588',
              '#003388',
              '#338877',
              '#55DDFF',
              '#00FF99',
              '#BBBBBB',
              '#77AAFF',
              '#00FFCC',
  */
          );
      }
  
      function SetupGraph($graph) {
  
          // graph
          /*
          $img = $graph->img;
          $height = $img->height;
          $graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
          */
          $graph->SetFrame(false);
          $graph->SetMarginColor('white');
          $graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
  
          // legend
          $graph->legend->SetFrameWeight(0);
          $graph->legend->Pos(0.5, 0.85, 'center', 'top');
          $graph->legend->SetFillColor('white');
          $graph->legend->SetLayout(LEGEND_HOR);
          $graph->legend->SetColumns(3);
          $graph->legend->SetShadow(false);
          $graph->legend->SetMarkAbsSize(5);
  
          // xaxis
          $graph->xaxis->title->SetColor($this->font_color);  
          $graph->xaxis->SetColor($this->axis_color, $this->font_color);    
          $graph->xaxis->SetTickSide(SIDE_BOTTOM);
          $graph->xaxis->SetLabelMargin(10);
                  
          // yaxis
          $graph->yaxis->title->SetColor($this->font_color);  
          $graph->yaxis->SetColor($this->axis_color, $this->font_color);    
          $graph->yaxis->SetTickSide(SIDE_LEFT);
          $graph->yaxis->SetLabelMargin(8);
          $graph->yaxis->HideLine();
          $graph->yaxis->HideTicks();
          $graph->xaxis->SetTitleMargin(15);
  
          // grid
          $graph->ygrid->SetColor($this->grid_color);
          $graph->ygrid->SetLineStyle('dotted');
  
  
          // font
          $graph->title->SetColor($this->font_color);
          $graph->subtitle->SetColor($this->font_color);
          $graph->subsubtitle->SetColor($this->font_color);
  
  //        $graph->img->SetAntiAliasing();
      }
  
  
      function SetupPieGraph($graph) {
  
          // graph
          $graph->SetFrame(false);
  
          // legend
          $graph->legend->SetFillColor('white');
  
          $graph->legend->SetFrameWeight(0);
          $graph->legend->Pos(0.5, 0.80, 'center', 'top');
          $graph->legend->SetLayout(LEGEND_HOR);
          $graph->legend->SetColumns(4);
  
          $graph->legend->SetShadow(false);
          $graph->legend->SetMarkAbsSize(5);
  
          // title
          $graph->title->SetColor($this->font_color);
          $graph->subtitle->SetColor($this->font_color);
          $graph->subsubtitle->SetColor($this->font_color);
  
          $graph->SetAntiAliasing();
      }
  
  
      function PreStrokeApply($graph) {
          if ($graph->legend->HasItems()) {
              $img = $graph->img;
              $graph->SetMargin(
                  $img->raw_left_margin, 
                  $img->raw_right_margin, 
                  $img->raw_top_margin, 
                  is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
              );
          }
      }
  
      function ApplyPlot($plot) {
  
          switch (get_class($plot))
          { 
              case 'GroupBarPlot':
              {
                  foreach ($plot->plots as $_plot) {
                      $this->ApplyPlot($_plot);
                  }
                  break;
              }
  
              case 'AccBarPlot':
              {
                  foreach ($plot->plots as $_plot) {
                      $this->ApplyPlot($_plot);
                  }
                  break;
              }
  
              case 'BarPlot':
              {
                  $plot->Clear();
  
                  $color = $this->GetNextColor();
                  $plot->SetColor($color);
                  $plot->SetFillColor($color);
                  //$plot->SetShadow();
                  break;
              }
  
              case 'LinePlot':
              {
                  $plot->Clear();
                  $plot->SetColor($this->GetNextColor());
                  $plot->SetWeight(2);
  //                $plot->SetBarCenter();
                  break;
              }
  
              case 'PiePlot':
              {
                  $plot->SetCenter(0.5, 0.45);
                  $plot->ShowBorder(false);
                  $plot->SetSliceColors($this->GetThemeColors());
                  break;
              }
  
              case 'PiePlot3D':
              {
                  $plot->SetSliceColors($this->GetThemeColors());
                  break;
              }
      
              default:
              {
              }
          }
      }
  }
  
  
  ?>