- Timestamp:
- 2012/02/06 11:05:15 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/graph/SC_GraphPie.php
r21420 r21441 48 48 $total = ""; 49 49 $new_total = ""; 50 if (!is_array($array)) {50 if (!is_array($array)) { 51 51 return; 52 52 } 53 53 $arrRet = array(); 54 foreach ($array as $val) {54 foreach ($array as $val) { 55 55 $total += $val; 56 56 } 57 if ($total <= 0) {57 if ($total <= 0) { 58 58 return; 59 59 } … … 62 62 $p_rate = 100 / $total; 63 63 $cnt = 0; 64 foreach ($array as $val) {64 foreach ($array as $val) { 65 65 $ret = round($val * $rate); 66 66 $new_total+= $ret; … … 91 91 function drawShade() { 92 92 $move = 1; 93 for ($i = ($this->cy + $this->cz); $i <= ($this->cy + $this->cz + ($this->cz * PIE_SHADE_IMPACT)); $i++) {93 for ($i = ($this->cy + $this->cz); $i <= ($this->cy + $this->cz + ($this->cz * PIE_SHADE_IMPACT)); $i++) { 94 94 imagefilledarc($this->image, $this->cx + $move, $i, $this->cw, $this->ch, 0, 360, $this->shade_color, IMG_ARC_PIE); 95 95 $move += 0.5; … … 115 115 116 116 // データが存在しない場合 117 if ($rd_max <= 0) {117 if ($rd_max <= 0) { 118 118 return; 119 119 } 120 120 121 121 // 影の描画 122 if ($this->shade_on) {122 if ($this->shade_on) { 123 123 $this->drawShade(); 124 124 } … … 131 131 for ($i = ($y + $z - 1); $i >= $y; $i--) { 132 132 $start = 0; 133 for ($j = 0; $j < $rd_max; $j++) {133 for ($j = 0; $j < $rd_max; $j++) { 134 134 // 角度が0度以上の場合のみ側面を描画する。 135 if ($arrRad[$j] > 0) {135 if ($arrRad[$j] > 0) { 136 136 $end = $start + $arrRad[$j]; 137 if ($start == 0 && $end == 360) {137 if ($start == 0 && $end == 360) { 138 138 // -90~270で指定すると円が描画できないので0~360に指定 139 139 imagearc($this->image, $x, $i, $w, $h, 0, 360, $this->arrDarkColor[($j % $dc_max)]); … … 151 151 // 上面の描画 152 152 $start = 0; 153 for ($i = 0; $i < $rd_max; $i++) {154 $end = $start + $arrRad[$i]; 155 if ($start == 0 && $end == 360) {153 for ($i = 0; $i < $rd_max; $i++) { 154 $end = $start + $arrRad[$i]; 155 if ($start == 0 && $end == 360) { 156 156 // -90~270で指定すると円が描画できないので0~360に指定 157 157 imagefilledarc($this->image, $x, $y, $w, $h, 0, 360, $this->arrColor[($i % $c_max)], IMG_ARC_PIE); … … 165 165 // 上面の縁取り 166 166 $start = 0; 167 for ($i = 0; $i < $rd_max; $i++) {168 $end = $start + $arrRad[$i]; 169 if ($start == 0 && $end == 360) {167 for ($i = 0; $i < $rd_max; $i++) { 168 $end = $start + $arrRad[$i]; 169 if ($start == 0 && $end == 360) { 170 170 // -90~270で指定すると円が描画できないので0~360に指定 171 171 imagearc($this->image, $x, $y, $w, $h, 0, 360 , $this->flame_color); … … 180 180 imageline($this->image, $x - ($w / 2), $y, $x - ($w / 2), $y + $z, $this->flame_color); 181 181 $start = 0; 182 for ($i = 0; $i < $rd_max; $i++) {182 for ($i = 0; $i < $rd_max; $i++) { 183 183 $end = $start + $arrRad[$i]; 184 184 // 前面のみ 185 if ($end > 90 && $end < 270) {185 if ($end > 90 && $end < 270) { 186 186 list($ax, $ay) = $this->lfGetArcPos($x, $y, $w, $h, $end); 187 187 // ラインのずれを補正する 188 if ($end > 180) {188 if ($end > 180) { 189 189 $ax = $ax + 1; 190 190 } … … 204 204 $rd_max = count($arrRad); 205 205 $start = 0; 206 for ($i = 0; $i < $rd_max; $i++) {206 for ($i = 0; $i < $rd_max; $i++) { 207 207 $center = $start + ($arrRad[$i] / 2); 208 208 $end = $start + $arrRad[$i];
Note: See TracChangeset
for help on using the changeset viewer.
