Changeset 10996


Ignore:
Timestamp:
2006/12/20 19:48:05 (19 years ago)
Author:
naka
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • temp/branches/ec-cube-beta/html/test/naka/graph.php

    r10995 r10996  
    2525                 
    2626        // ±ß¥°¥é¥ÕÉÁ²è 
    27         $objGraphPie->drawGraph(); 
     27        //$objGraphPie->drawGraph(); 
    2828         
     29        $x = $objGraphPie->cx; 
     30        $y = $objGraphPie->cy; 
     31        $z = $objGraphPie->cz; 
     32        $h = $objGraphPie->ch; 
     33        $w = $objGraphPie->cw; 
     34         
     35        // ¥Ç¡¼¥¿¤Î³ÑÅÙ¤ò¼èÆÀ¤¹¤ë 
     36        $arrRad = $objGraphPie->getCircleData($objGraphPie->arrData); 
     37        $rd_max = count($arrRad); 
     38         
     39        // ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç 
     40        if($rd_max <= 0) { 
     41            return; 
     42        } 
     43         
     44        // ±Æ¤ÎÉÁ²è 
     45        if($objGraphPie->shade_on) { 
     46            $objGraphPie->drawShade(); 
     47        } 
     48             
     49        // ¿§¿ô¤Î¼èÆÀ 
     50        $c_max = count($objGraphPie->arrColor); 
     51        $dc_max = count($objGraphPie->arrDarkColor); 
     52         
     53        // ¦Ì̤ÎÉÁ²è        
     54        for ($i = ($y + $z - 1); $i >= $y; $i--) { 
     55            $start = 0; 
     56            for($j = 0; $j < $rd_max; $j++) { 
     57                // ³ÑÅÙ¤¬0Åٰʾå¤Î¾ì¹ç¤Î¤ß¦Ì̤òÉÁ²è¤¹¤ë¡£ 
     58                if($arrRad[$j] > 0) { 
     59                    $end = $start + $arrRad[$j]; 
     60                    if($start == 0 && $end == 360) { 
     61                        // -90¢·270¤Ç»ØÄꤹ¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê 
     62                        imagearc($objGraphPie->image, $x, $i, $w, $h, 0, 360, $objGraphPie->arrDarkColor[($j % $dc_max)]); 
     63                    } else { 
     64                        // -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë 
     65                        imagearc($objGraphPie->image, $x, $i, $w, $h, $start - 90, $end - 90, $objGraphPie->arrDarkColor[($j % $dc_max)]);   
     66                    }            
     67                    $start = $end; 
     68                } 
     69            } 
     70        } 
     71        // ÄìÌ̤ÎÉÁ²è 
     72        imagearc($objGraphPie->image, $x, $y + $z, $w, $h, 0, 180 , $objGraphPie->flame_color); 
     73 
     74        // ¾åÌ̤ÎÉÁ²è 
     75        $start = 0; 
     76        for($i = 0; $i < $rd_max; $i++) { 
     77            $end = $start + $arrRad[$i]; 
     78            if($start == 0 && $end == 360) { 
     79                // -90¢·270¤Ç»ØÄꤹ¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê 
     80                imagefilledarc($objGraphPie->image, $x, $y, $w, $h, 0, 360, $objGraphPie->arrColor[($i % $c_max)], IMG_ARC_PIE);             
     81            } else { 
     82                // -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë¡£         
     83                imagefilledarc($objGraphPie->image, $x, $y, $w, $h, $start - 90, $end - 90, $objGraphPie->arrColor[($i % $c_max)], IMG_ARC_PIE); 
     84            } 
     85            $start = $end; 
     86        } 
     87 
     88        // ¾åÌ̤αï¼è¤ê 
     89        $start = 0; 
     90        for($i = 0; $i < $rd_max; $i++) { 
     91            $end = $start + $arrRad[$i]; 
     92            if($start == 0 && $end == 360) { 
     93                // -90¢·270¤Ç»ØÄꤹ¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê 
     94                imagearc($objGraphPie->image, $x, $y, $w, $h, 0, 360 , $objGraphPie->flame_color); 
     95            } 
     96            // -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë¡£ 
     97            imagefilledarc($objGraphPie->image, $x, $y, $w, $h, $start - 90, $end - 90, $objGraphPie->flame_color, IMG_ARC_EDGED|IMG_ARC_NOFILL); 
     98            $start = $end; 
     99        } 
     100 
     101        // ¦Ì̤αï¼è¤ê 
     102        imageline($objGraphPie->image, $x + ($w / 2), $y, $x + ($w / 2), $y + $z, $objGraphPie->flame_color); 
     103        imageline($objGraphPie->image, $x - ($w / 2), $y, $x - ($w / 2), $y + $z, $objGraphPie->flame_color); 
     104        $start = 0; 
     105        for($i = 0; $i < $rd_max; $i++) { 
     106            $end = $start + $arrRad[$i]; 
     107            // Á°Ì̤Τߠ
     108            if($end > 90 && $end < 270) { 
     109                list($ax, $ay) = lfGetArcPos($x, $y, $w, $h, $end); 
     110                // ¥é¥¤¥ó¤Î¤º¤ì¤òÊäÀµ¤¹¤ë 
     111                if($end > 180) { 
     112                    $ax = $ax + 1; 
     113                } 
     114                imageline($objGraphPie->image, $ax, $ay, $ax, $ay + $z, $objGraphPie->flame_color); 
     115            } 
     116            $start = $end;   
     117        } 
     118                 
     119        // ¥é¥Ù¥ë¤ÎÉÁ²è 
     120        $objGraphPie->drawLabel($arrRad); 
     121        // ËÞÎã¤ÎÉÁ²è 
     122        $objGraphPie->drawLegend(count($objGraphPie->arrData)); 
     123                 
    29124        $objGraphPie->outputGraph(); 
    30125        exit(); 
Note: See TracChangeset for help on using the changeset viewer.