Ignore:
Timestamp:
2007/03/11 06:27:25 (19 years ago)
Author:
nanasess
Message:

r11729 の変更を取消

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu/html/admin/total/class/SC_GraphLine.php

    r11729 r11730  
    88require_once($SC_GRAPHLINE_DIR . "/SC_GraphBase.php");   
    99 
    10 // 折れ線グラフ生成クラス 
     10// ÀÞ¤ìÀþ¥°¥é¥ÕÀ¸À®¥¯¥é¥¹ 
    1111class SC_GraphLine extends SC_GraphBase{ 
    1212    var $area_width; 
    1313    var $area_height; 
    1414    var $ygrid_on; 
    15     var $graph_max;     // グラフのエリア最大値(Y軸頂点の値) 
     15    var $graph_max;     // ¥°¥é¥Õ¤Î¥¨¥ê¥¢ºÇÂçÃÍ(Y¼´ÄºÅÀ¤ÎÃÍ) 
    1616    var $arrXLabel;  
    17     var $XLabelAngle;   // X軸ラベル角度   
    18     var $XTitle;        // X軸タイトル 
    19     var $YTitle;        // Y軸タイトル 
    20     var $arrDataList;   // グラフデータを格納 
    21     var $arrPointList;  // 折れ線座標を格納 
    22     var $line_max;      // 複数の描画の場合に加算していく 
     17    var $XLabelAngle;   // X¼´¥é¥Ù¥ë³ÑÅÙ     
     18    var $XTitle;        // X¼´¥¿¥¤¥È¥ë 
     19    var $YTitle;        // Y¼´¥¿¥¤¥È¥ë 
     20    var $arrDataList;   // ¥°¥é¥Õ¥Ç¡¼¥¿¤ò³ÊǼ 
     21    var $arrPointList;  // ÀÞ¤ìÀþºÂɸ¤ò³ÊǼ 
     22    var $line_max;      // Ê£¿ô¤ÎÉÁ²è¤Î¾ì¹ç¤Ë²Ã»»¤·¤Æ¤¤¤¯ 
    2323     
    2424    var $x_margin; 
    2525    var $y_margin; 
    2626             
    27     // コンストラクタ 
     27    // ¥³¥ó¥¹¥È¥é¥¯¥¿ 
    2828    function SC_GraphLine( 
    2929        $bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP, 
     
    4040    } 
    4141     
    42     // X軸ラベルの角度セット 
     42    // X¼´¥é¥Ù¥ë¤Î³ÑÅÙ¥»¥Ã¥È 
    4343    function setXLabelAngle($Angle) { 
    4444        $this->XLabelAngle = $Angle; 
    4545    } 
    4646     
    47     // Y軸タイトル 
     47    // Y¼´¥¿¥¤¥È¥ë 
    4848    function drawYTitle() { 
    49         // Y軸にタイトルを入れる 
     49        // Y¼´¤Ë¥¿¥¤¥È¥ë¤òÆþ¤ì¤ë 
    5050        if($this->YTitle != "") { 
    5151            $text_width = $this->getTextWidth($this->YTitle, FONT_SIZE); 
     
    5656    } 
    5757     
    58     // X軸タイトル 
     58    // X¼´¥¿¥¤¥È¥ë 
    5959    function drawXTitle() { 
    60         // Y軸にタイトルを入れる 
     60        // Y¼´¤Ë¥¿¥¤¥È¥ë¤òÆþ¤ì¤ë 
    6161        if($this->XTitle != "") { 
    6262            $text_width = $this->getTextWidth($this->XTitle, FONT_SIZE); 
     
    6767    } 
    6868     
    69     // Y軸の描画 
     69    // Y¼´¤ÎÉÁ²è 
    7070    function drawYLine() { 
    7171        imageline($this->image, $this->left, $this->top, $this->left, $this->top + $this->area_height, $this->flame_color); 
    72         // 目盛り幅を求める(中間点は自動) 
     72        // ÌÜÀ¹¤êÉý¤òµá¤á¤ë(Ãæ´ÖÅÀ¤Ï¼«Æ°) 
    7373        $size = $this->area_height / (LINE_Y_SCALE * 2); 
    74         // 上から目盛りを入れていく 
     74        // ¾å¤«¤éÌÜÀ¹¤ê¤òÆþ¤ì¤Æ¤¤¤¯ 
    7575        $pos = 0; 
    7676        for($i = 0; $i < (LINE_Y_SCALE * 2); $i++) { 
    77             // 目盛り幅 
     77            // ÌÜÀ¹¤êÉý 
    7878            if(($i % 2) == 0) { 
    7979                $sw = LINE_SCALE_SIZE; 
     
    8787            $pos += $size; 
    8888        } 
    89         // Y軸に目盛り値を入れる 
     89        // Y¼´¤ËÌÜÀ¹¤êÃͤòÆþ¤ì¤ë 
    9090        $this->setYScale(); 
    9191        $this->drawYTitle();     
    9292    } 
    9393     
    94     // X軸の描画 
     94    // X¼´¤ÎÉÁ²è 
    9595    function drawXLine($bar = false) { 
    9696        imageline($this->image, $this->left, $this->top + $this->area_height, $this->left + $this->area_width, $this->top + $this->area_height, $this->flame_color); 
     
    9898        $count = count($arrPointList); 
    9999         
    100         // 棒グラフの場合は半目盛りずらす 
     100        // ËÀ¥°¥é¥Õ¤Î¾ì¹ç¤ÏȾÌÜÀ¹¤ê¤º¤é¤¹ 
    101101        if($bar) { 
    102102            $half_scale = intval($this->area_width / ($count + 1) / 2); 
     
    105105        } 
    106106         
    107         // ラベルの表示インターバルを算出 
    108         $interval = ceil($count / LINE_XLABEL_MAX); // 切り上げ              
    109         for($i = 0; $i < $count; $i++) { 
    110             // X軸に目盛りを入れる 
     107        // ¥é¥Ù¥ë¤Îɽ¼¨¥¤¥ó¥¿¡¼¥Ð¥ë¤ò»»½Ð 
     108        $interval = ceil($count / LINE_XLABEL_MAX); // ÀÚ¤ê¾å¤²              
     109        for($i = 0; $i < $count; $i++) { 
     110            // X¼´¤ËÌÜÀ¹¤ê¤òÆþ¤ì¤ë 
    111111            $x = $arrPointList[$i][0]; 
    112112            $pos = $this->top + $this->area_height; 
    113113            imageline($this->image, $x - $half_scale, $pos, $x - $half_scale, $pos - LINE_SCALE_SIZE,  $this->flame_color);          
    114             // ラベルを入れる 
     114            // ¥é¥Ù¥ë¤òÆþ¤ì¤ë 
    115115            if(($i % $interval) == 0) { 
    116116                $text_width = $this->getTextWidth($this->arrXLabel[$i], FONT_SIZE); 
     
    123123        } 
    124124         
    125         // 棒グラフの場合は最後の目盛りを一つ追加する 
     125        // ËÀ¥°¥é¥Õ¤Î¾ì¹ç¤ÏºÇ¸å¤ÎÌÜÀ¹¤ê¤ò°ì¤ÄÄɲ乤ë 
    126126        if($bar) { 
    127127            imageline($this->image, $x + $half_scale, $pos, $x + $half_scale, $pos - LINE_SCALE_SIZE,  $this->flame_color);  
     
    131131    } 
    132132         
    133     // グリッド表示 
     133    // ¥°¥ê¥Ã¥Éɽ¼¨ 
    134134    function setYGridOn($ygrid_on) { 
    135135        $this->ygrid_on = $ygrid_on; 
    136136    } 
    137137     
    138     // ポイントの描画 
     138    // ¥Ý¥¤¥ó¥È¤ÎÉÁ²è 
    139139    function setMark($line_no, $left, $top, $size = LINE_MARK_SIZE) { 
    140         // 偶数に変換しておく 
     140        // ¶ö¿ô¤ËÊÑ´¹¤·¤Æ¤ª¤¯ 
    141141        $size += $size % 2; 
    142142        $array = array( 
     
    151151    }    
    152152     
    153     // Y軸目盛りに値を入れる 
     153    // Y¼´ÌÜÀ¹¤ê¤ËÃͤòÆþ¤ì¤ë 
    154154    function setYScale() { 
    155         // 1目盛りの値 
     155        // 1ÌÜÀ¹¤ê¤ÎÃÍ 
    156156        $number = intval($this->graph_max / LINE_Y_SCALE);               
    157         // 目盛り幅を求める 
     157        // ÌÜÀ¹¤êÉý¤òµá¤á¤ë 
    158158        $size = $this->area_height / LINE_Y_SCALE; 
    159159        $pos = 0; 
     
    169169    //  
    170170    function setMax($arrData) { 
    171         // データの最大値を取得する。 
     171        // ¥Ç¡¼¥¿¤ÎºÇÂçÃͤò¼èÆÀ¤¹¤ë¡£ 
    172172        $data_max = max($arrData); 
    173         // 10の何倍かを取得 
     173        // 10¤Î²¿Çܤ«¤ò¼èÆÀ 
    174174        $figure = strlen($data_max) - 1; 
    175         // 次の桁を計算する 
     175        // ¼¡¤Î·å¤ò·×»»¤¹¤ë 
    176176        $tenval = pow(10, $figure); 
    177         // グラフ上での最大値を求める 
     177        // ¥°¥é¥Õ¾å¤Ç¤ÎºÇÂçÃͤòµá¤á¤ë 
    178178        $this->graph_max = $tenval * (intval($data_max / $tenval) + 1); 
    179         // 最大値が10未満の場合の対応 
     179        // ºÇÂçÃͤ¬10̤Ëþ¤Î¾ì¹ç¤ÎÂбþ 
    180180        if($this->graph_max < 10) { 
    181181            $this->graph_max = 10; 
     
    183183    } 
    184184     
    185     // グラフの描画 
     185    // ¥°¥é¥Õ¤ÎÉÁ²è 
    186186    function drawGraph() { 
    187         // グラフ背景を描画 
     187        // ¥°¥é¥ÕÇØ·Ê¤òÉÁ²è 
    188188        $this->drawYLine(); 
    189189        $this->drawXLine(); 
    190190         
    191         // 折れ線グラフ描画 
     191        // ÀÞ¤ìÀþ¥°¥é¥ÕÉÁ²è 
    192192        for($i = 0; $i < $this->line_max; $i++) { 
    193193            $this->drawLine($i); 
    194194        } 
    195195         
    196         // マークを描画 
     196        // ¥Þ¡¼¥¯¤òÉÁ²è 
    197197        for($i = 0; $i < $this->line_max; $i++) { 
    198198            $this->drawMark($i); 
    199199        } 
    200200         
    201         // ラベルを描画 
     201        // ¥é¥Ù¥ë¤òÉÁ²è 
    202202        for($i = 0; $i < $this->line_max; $i++) { 
    203203            $this->drawLabel($i);        
    204204        } 
    205205 
    206         // 凡例の描画 
     206        // ËÞÎã¤ÎÉÁ²è 
    207207        $this->drawLegend();     
    208208    } 
    209209     
    210     // ラインを描画する 
     210    // ¥é¥¤¥ó¤òÉÁ²è¤¹¤ë 
    211211    function drawLine($line_no) { 
    212212        $arrPointList = $this->arrPointList[$line_no]; 
     
    224224    } 
    225225     
    226     // マークを描画する 
     226    // ¥Þ¡¼¥¯¤òÉÁ²è¤¹¤ë 
    227227    function drawMark($line_no) { 
    228228        $arrPointList = $this->arrPointList[$line_no]; 
     
    235235    } 
    236236     
    237     // ラベルを描画する 
     237    // ¥é¥Ù¥ë¤òÉÁ²è¤¹¤ë 
    238238    function drawLabel($line_no) { 
    239239        $arrData = $this->arrDataList[$line_no]; 
     
    250250    } 
    251251     
    252     // データをセットする 
     252    // ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë 
    253253    function setData($arrData) { 
    254254        $this->arrDataList[$this->line_max] = array_values((array)$arrData); 
    255255        $this->setMax($this->arrDataList[$this->line_max]); 
    256         // 値の描画変換率 
     256        // ÃͤÎÉÁ²èÊÑ´¹Î¨ 
    257257        $rate = $this->area_height / $this->graph_max; 
    258         // 描画率を計算 
     258        // ÉÁ²èΨ¤ò·×»» 
    259259        $count = count($this->arrDataList[$this->line_max]); 
    260260        $scale_width = $this->area_width / ($count + 1);         
    261261        $this->arrPointList[$this->line_max] = array(); 
    262262        for($i = 0; $i < $count; $i++) { 
    263             // X座標を求める 
     263            // XºÂɸ¤òµá¤á¤ë 
    264264            $x = intval($this->left + ($scale_width * ($i + 1))); 
    265             // Y座標を求める 
     265            // YºÂɸ¤òµá¤á¤ë 
    266266            $y = intval($this->top + $this->area_height - ($this->arrDataList[$this->line_max][$i] * $rate)); 
    267             // XY座標を保存する 
     267            // XYºÂɸ¤òÊݸ¤¹¤ë 
    268268            $this->arrPointList[$this->line_max][] = array($x, $y); 
    269269        } 
     
    271271    } 
    272272     
    273     // X軸ラベルをセットする 
     273    // X¼´¥é¥Ù¥ë¤ò¥»¥Ã¥È¤¹¤ë 
    274274    function setXLabel($arrXLabel) { 
    275275        $this->arrXLabel = array_values((array)$arrXLabel); 
    276276    } 
    277277     
    278     // X軸タイトルをセットする 
     278    // X¼´¥¿¥¤¥È¥ë¤ò¥»¥Ã¥È¤¹¤ë 
    279279    function setXTitle($title) { 
    280280        $this->XTitle = $title; 
    281281    } 
    282282     
    283     // Y軸タイトルをセットする 
     283    // Y¼´¥¿¥¤¥È¥ë¤ò¥»¥Ã¥È¤¹¤ë 
    284284    function setYTitle($title) { 
    285285        $this->YTitle = $title; 
Note: See TracChangeset for help on using the changeset viewer.