- Timestamp:
- 2012/02/06 11:05:15 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/graph/SC_GraphBase.php
r21420 r21441 215 215 $new_height = $this->bgh * 0.8; 216 216 $tmp_image = imagecreatetruecolor($new_width, $new_height); 217 if (imagecopyresampled($tmp_image, $this->image, 0, 0, 0, 0, $new_width, $new_height, $this->bgw, $this->bgh)) {217 if (imagecopyresampled($tmp_image, $this->image, 0, 0, 0, 0, $new_width, $new_height, $this->bgw, $this->bgh)) { 218 218 $this->image = $tmp_image; 219 219 } … … 225 225 $count = count($this->arrRGB); 226 226 // 通常色の設定 227 for ($i = 0; $i < $count; $i++) {227 for ($i = 0; $i < $count; $i++) { 228 228 $this->arrColor[$i] = $this->lfGetImageColor($this->image, $this->arrRGB[$i]); 229 229 } 230 230 // 暗色の設定 231 for ($i = 0; $i < $count; $i++) {231 for ($i = 0; $i < $count; $i++) { 232 232 $this->arrDarkColor[$i] = $this->lfGetImageDarkColor($this->image, $this->arrRGB[$i]); 233 233 } … … 241 241 // 画像を出力する 242 242 function outputGraph($header = true, $filename = "") { 243 if ($header) {243 if ($header) { 244 244 header('Content-type: image/png'); 245 245 } … … 247 247 if ($filename != "") { 248 248 imagepng($this->image, $filename); 249 } else{249 } else { 250 250 imagepng($this->image); 251 251 } … … 272 272 $angle = -$angle; 273 273 // ラベル背景 274 if ($labelbg) {274 if ($labelbg) { 275 275 $text_width = $this->getTextWidth($text, $font_size); 276 276 imagefilledrectangle($this->image, $left - 2, $top - 2, $left + $text_width + 2, $top + $font_size + 2, $this->labelbg_color); … … 292 292 $text = mb_convert_encoding($text, "EUC-JP", CHAR_CODE); 293 293 //$text = mb_convert_encoding($text, CHAR_CODE); 294 if ($color != NULL) {294 if ($color != NULL) { 295 295 ImageTTFText($this->image, $font_size, $angle, $left, $top + $font_size, $color, FONT_REALFILE, $text); 296 296 } else { … … 311 311 function debugPrint($text) { 312 312 $text = mb_convert_encoding($text, "UTF-8", CHAR_CODE); 313 if (!isset($this->text_top)) {313 if (!isset($this->text_top)) { 314 314 $this->text_top = FONT_SIZE + LINE_PAD; 315 315 } … … 322 322 function drawLegend($legend_max = "", $clabelbg = true) { 323 323 // 凡例が登録されていなければ中止 324 if (count($this->arrLegend) <= 0) {324 if (count($this->arrLegend) <= 0) { 325 325 return; 326 326 } 327 327 328 if ($legend_max != "") {328 if ($legend_max != "") { 329 329 $label_max = $legend_max; 330 330 } else { … … 337 337 338 338 // 一番文字数が多いものを取得 339 for ($i = 0; $i < $label_max; $i++) {339 for ($i = 0; $i < $label_max; $i++) { 340 340 $text_len = strlen($this->arrLegend[$i]); 341 if ($text_max < $text_len) {341 if ($text_max < $text_len) { 342 342 $text_max = $text_len; 343 343 } … … 351 351 $top = LEGEND_TOP; 352 352 // カラーラベル背景の描画 353 if ($clabelbg) {353 if ($clabelbg) { 354 354 $this->drawClabelBG($left - LINE_PAD, $top, $left + $width_max, $top + $height_max + LINE_PAD); 355 355 } … … 358 358 // 色数の取得 359 359 $c_max = count($this->arrColor); 360 for ($i = 0; $i < $label_max; $i++) {360 for ($i = 0; $i < $label_max; $i++) { 361 361 // カラーアイコンの表示 362 362 imagerectangle($this->image, $left, $top, $left + FONT_SIZE, $top + FONT_SIZE, $this->flame_color); … … 371 371 function drawClabelBG($left, $top, $right, $bottom) { 372 372 // 影の描画 373 if ($this->shade_on) {373 if ($this->shade_on) { 374 374 imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom + 2, $this->shade_color); 375 375 } … … 459 459 /** 表示色の取得 */ 460 460 function lfGetImageColor($image, $array) { 461 if (count($array) != 3) {461 if (count($array) != 3) { 462 462 return NULL; 463 463 } … … 468 468 /** 影用表示色の取得 */ 469 469 function lfGetImageDarkColor($image, $array) { 470 if (count($array) != 3) {470 if (count($array) != 3) { 471 471 return NULL; 472 472 } 473 473 $i = 0; 474 foreach ($array as $val) {474 foreach ($array as $val) { 475 475 $dark[$i] = $val - 45; 476 if ($dark[$i] < 0) {476 if ($dark[$i] < 0) { 477 477 $dark[$i] = 0; 478 478 }
Note: See TracChangeset
for help on using the changeset viewer.