source: temp/branches/ec-cube-beta/html/test/naka/graph.php @ 11002

Revision 11002, 3.8 KB checked in by naka, 20 years ago (diff)
Line 
1<?php
2
3require_once("../../require.php");
4
5require_once(HTML_PATH . "admin/total/class/SC_GraphPie.php");
6require_once(HTML_PATH . "admin/total/class/SC_GraphLine.php");
7require_once(HTML_PATH . "admin/total/class/SC_GraphBar.php");
8
9        $objGraphPie = new SC_GraphPie();
10       
11        /* ¥Ç¥Ð¥Ã¥°É½¼¨ÍÑ by naka
12        foreach($arrList as $key => $val) {
13            $objGraphPie->debugPrint("key:$key val:$val");
14        }
15        */
16       
17        $arrList = array(
18            'A' => 1,
19            'B' => 2,
20            'C' => 3           
21        );
22       
23        // ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
24        $objGraphPie->setData($arrList);
25               
26        // ±ß¥°¥é¥ÕÉÁ²è
27        //$objGraphPie->drawGraph();
28       
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        // ÄìÌ̤ÎÉÁ²è
73        imagearc($objGraphPie->image, $x, $y + $z, $w, $h, 0, 180 , $objGraphPie->flame_color);
74        /*
75        // ¾åÌ̤ÎÉÁ²è
76        $start = 0;
77        for($i = 0; $i < $rd_max; $i++) {
78            $end = $start + $arrRad[$i];
79            if($start == 0 && $end == 360) {
80                // -90¢·270¤Ç»ØÄꤹ¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê
81                imagefilledarc($objGraphPie->image, $x, $y, $w, $h, 0, 360, $objGraphPie->arrColor[($i % $c_max)], IMG_ARC_PIE);           
82            } else {
83                // -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë¡£       
84                imagefilledarc($objGraphPie->image, $x, $y, $w, $h, $start - 90, $end - 90, $objGraphPie->arrColor[($i % $c_max)], IMG_ARC_PIE);
85            }
86            $start = $end;
87        }
88
89        // ¾åÌ̤αï¼è¤ê
90        $start = 0;
91        for($i = 0; $i < $rd_max; $i++) {
92            $end = $start + $arrRad[$i];
93            if($start == 0 && $end == 360) {
94                // -90¢·270¤Ç»ØÄꤹ¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê
95                imagearc($objGraphPie->image, $x, $y, $w, $h, 0, 360 , $objGraphPie->flame_color);
96            }
97            // -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë¡£
98            imagefilledarc($objGraphPie->image, $x, $y, $w, $h, $start - 90, $end - 90, $objGraphPie->flame_color, IMG_ARC_EDGED|IMG_ARC_NOFILL);
99            $start = $end;
100        }
101
102        // ¦Ì̤αï¼è¤ê
103        imageline($objGraphPie->image, $x + ($w / 2), $y, $x + ($w / 2), $y + $z, $objGraphPie->flame_color);
104        imageline($objGraphPie->image, $x - ($w / 2), $y, $x - ($w / 2), $y + $z, $objGraphPie->flame_color);
105        $start = 0;
106        for($i = 0; $i < $rd_max; $i++) {
107            $end = $start + $arrRad[$i];
108            // Á°Ì̤Τß
109            if($end > 90 && $end < 270) {
110                list($ax, $ay) = lfGetArcPos($x, $y, $w, $h, $end);
111                // ¥é¥¤¥ó¤Î¤º¤ì¤òÊäÀµ¤¹¤ë
112                if($end > 180) {
113                    $ax = $ax + 1;
114                }
115                imageline($objGraphPie->image, $ax, $ay, $ax, $ay + $z, $objGraphPie->flame_color);
116            }
117            $start = $end; 
118        }
119               
120        // ¥é¥Ù¥ë¤ÎÉÁ²è
121        $objGraphPie->drawLabel($arrRad);
122        // ËÞÎã¤ÎÉÁ²è
123        $objGraphPie->drawLegend(count($objGraphPie->arrData));
124        */
125        $objGraphPie->outputGraph();
126        exit();
127?>
Note: See TracBrowser for help on using the repository browser.