- Timestamp:
- 2012/05/30 14:32:19 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/graph/SC_Graph_Pie.php
r21771 r21864 3 3 * This file is part of EC-CUBE 4 4 * 5 * Copyright(c) 2000-201 1LOCKON CO.,LTD. All Rights Reserved.5 * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved. 6 6 * 7 7 * http://www.lockon.co.jp/ … … 133 133 $end = $start + $arrRad[$j]; 134 134 if ($start == 0 && $end == 360) { 135 // -90~270で指定すると円が描画できないので0~360に指定 136 imagearc($this->image, $x, $i, $w, $h, 0, 360, $this->arrDarkColor[($j % $dc_max)]); 137 } else { 138 // -90°は12時の位置から開始するように補正している 139 imagearc($this->image, $x, $i, $w, $h, $start - 90, $end - 90, $this->arrDarkColor[($j % $dc_max)]); 140 } 141 $start = $end; 142 } 143 } 144 } 145 // 底面の描画 146 imagearc($this->image, $x, $y + $z, $w, $h, 0, 180 , $this->flame_color); 147 148 // 上面の描画 149 $start = 0; 150 for ($i = 0; $i < $rd_max; $i++) { 151 $end = $start + $arrRad[$i]; 152 if ($start == 0 && $end == 360) { 153 // -90~270で指定すると円が描画できないので0~360に指定 154 imagefilledarc($this->image, $x, $y, $w, $h, 0, 360, $this->arrColor[($i % $c_max)], IMG_ARC_PIE); 155 } else { 156 // -90°は12時の位置から開始するように補正している。 157 imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->arrColor[($i % $c_max)], IMG_ARC_PIE); 158 } 159 $start = $end; 160 } 161 162 // 上面の縁取り 163 $start = 0; 164 for ($i = 0; $i < $rd_max; $i++) { 165 $end = $start + $arrRad[$i]; 166 if ($start == 0 && $end == 360) { 167 // -90~270で指定すると円が描画できないので0~360に指定 168 imagearc($this->image, $x, $y, $w, $h, 0, 360 , $this->flame_color); 169 } 170 // -90°は12時の位置から開始するように補正している。 171 imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->flame_color, IMG_ARC_EDGED|IMG_ARC_NOFILL); 172 $start = $end; 173 } 174 175 // 側面の縁取り 176 imageline($this->image, $x + ($w / 2), $y, $x + ($w / 2), $y + $z, $this->flame_color); 177 imageline($this->image, $x - ($w / 2), $y, $x - ($w / 2), $y + $z, $this->flame_color); 178 $start = 0; 179 for ($i = 0; $i < $rd_max; $i++) { 180 $end = $start + $arrRad[$i]; 181 // 前面のみ 182 if ($end > 90 && $end < 270) { 183 list($ax, $ay) = $this->lfGetArcPos($x, $y, $w, $h, $end); 184 // ラインのずれを補正する 185 if ($end > 180) { 186 $ax = $ax + 1; 187 } 188 imageline($this->image, $ax, $ay, $ax, $ay + $z, $this->flame_color); 189 } 190 $start = $end; 191 } 192 193 // ラベルの描画 194 $this->drawLabel($arrRad); 195 // 凡例の描画 196 $this->drawLegend(count($this->arrData)); 197 } 198 199 // 円グラフのラベルを描画する 200 function drawLabel($arrRad) { 201 $rd_max = count($arrRad); 202 $start = 0; 203 for ($i = 0; $i < $rd_max; $i++) { 204 $center = $start + ($arrRad[$i] / 2); 205 $end = $start + $arrRad[$i]; 206 list($sx, $sy) = $this->lfGetArcPos($this->cx, $this->cy, ($this->cw / 1.5), ($this->ch / 1.5), $center); 207 list($ex, $ey) = $this->lfGetArcPos($this->cx, $this->cy, ($this->cw * 1.5), ($this->ch * 1.5), $center); 208 // 指示線の描画 209 imageline($this->image, $sx, $sy, $ex + 2, $ey - PIE_LABEL_UP, $this->flame_color); 210 $this->setText(FONT_SIZE, $ex - 10, $ey - PIE_LABEL_UP - FONT_SIZE, $this->arrLabel[$i], NULL, 0, true); 211 $start = $end; 212 } 213 } 214 } 135 // -90~270で指定
Note: See TracChangeset
for help on using the changeset viewer.