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