- Timestamp:
- 2013/02/18 19:09:54 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/graph/SC_Graph_Base.php
r22206 r22567 131 131 * @version $Id$ 132 132 */ 133 class SC_Graph_Base { 133 class SC_Graph_Base 134 { 134 135 135 136 // {{{ properties … … 182 183 183 184 // コンストラクタ 184 function __construct($bgw, $bgh, $left, $top) { 185 function __construct($bgw, $bgh, $left, $top) 186 { 185 187 $this->init(); 186 188 // 画像作成 … … 211 213 212 214 // リサンプル(画像を滑らかに縮小する) 213 function resampled() { 215 function resampled() 216 { 214 217 $new_width = $this->bgw * 0.8; 215 218 $new_height = $this->bgh * 0.8; … … 221 224 222 225 // オブジェクトカラーの設定 223 function setColorList($arrRGB) { 226 function setColorList($arrRGB) 227 { 224 228 $this->arrRGB = $arrRGB; 225 229 $count = count($this->arrRGB); … … 235 239 236 240 // 影のありなし 237 function setShadeOn($shade_on) { 241 function setShadeOn($shade_on) 242 { 238 243 $this->shade_on = $shade_on; 239 244 } 240 245 241 246 // 画像を出力する 242 function outputGraph($header = true, $filename = '') { 247 function outputGraph($header = true, $filename = '') 248 { 243 249 if ($header) { 244 250 header('Content-type: image/png'); … … 255 261 256 262 // 描画時のテキスト幅を求める 257 function getTextWidth($text, $font_size) { 263 function getTextWidth($text, $font_size) 264 { 258 265 $text_len = strlen($text); 259 266 $ret = $font_size * $text_len * TEXT_RATE; … … 268 275 269 276 // テキストを出力する 270 function setText($font_size, $left, $top, $text, $color = NULL, $angle = 0, $labelbg = false) { 277 function setText($font_size, $left, $top, $text, $color = NULL, $angle = 0, $labelbg = false) 278 { 271 279 // 時計回りに角度を変更 272 280 $angle = -$angle; … … 300 308 301 309 // タイトルを出力する 302 function drawTitle($text, $font_size = TITLE_FONT_SIZE) { 310 function drawTitle($text, $font_size = TITLE_FONT_SIZE) 311 { 303 312 // 出力位置の算出 304 313 $text_width = $this->getTextWidth($text, $font_size); … … 309 318 310 319 // ログを出力する 311 function debugPrint($text) { 320 function debugPrint($text) 321 { 312 322 $text = mb_convert_encoding($text, 'UTF-8', CHAR_CODE); 313 323 if (!isset($this->text_top)) { … … 320 330 321 331 // カラーラベルを描画 322 function drawLegend($legend_max = '', $clabelbg = true) { 332 function drawLegend($legend_max = '', $clabelbg = true) 333 { 323 334 // 凡例が登録されていなければ中止 324 335 if (count($this->arrLegend) <= 0) { … … 369 380 370 381 // カラーラベル背景の描画 371 function drawClabelBG($left, $top, $right, $bottom) { 382 function drawClabelBG($left, $top, $right, $bottom) 383 { 372 384 // 影の描画 373 385 if ($this->shade_on) { … … 380 392 381 393 // 凡例をセットする 382 function setLegend($arrLegend) { 394 function setLegend($arrLegend) 395 { 383 396 $this->arrLegend = array_values((array)$arrLegend); 384 397 } … … 395 408 * @return void 396 409 */ 397 function init() { 410 function init() 411 { 398 412 // 凡例背景 399 413 $this->ARR_LEGENDBG_COLOR = array(245,245,245); … … 437 451 * @return array 円の中心点と直径から弧の終端座標の配列 438 452 */ 439 function lfGetArcPos($cx, $cy, $cw, $ch, $e) { 453 function lfGetArcPos($cx, $cy, $cw, $ch, $e) 454 { 440 455 // 三角関数用の角度を求める 441 456 $s = 90 - $e; … … 448 463 449 464 /** 画像にテキストを描画する */ 450 function lfImageText($dst_image, $text, $font_size, $left, $top, $font, $arrRGB) { 465 function lfImageText($dst_image, $text, $font_size, $left, $top, $font, $arrRGB) 466 { 451 467 $color = ImageColorAllocate($dst_image, $arrRGB[0], $arrRGB[1], $arrRGB[2]); 452 468 $text = mb_convert_encoding($text, 'UTF-8', CHAR_CODE); … … 458 474 459 475 /** 表示色の取得 */ 460 function lfGetImageColor($image, $array) { 476 function lfGetImageColor($image, $array) 477 { 461 478 if (count($array) != 3) { 462 479 return NULL; … … 467 484 468 485 /** 影用表示色の取得 */ 469 function lfGetImageDarkColor($image, $array) { 486 function lfGetImageDarkColor($image, $array) 487 { 470 488 if (count($array) != 3) { 471 489 return NULL;
Note: See TracChangeset
for help on using the changeset viewer.