source: branches/comu/html/test/naka/graph.php @ 2

Revision 2, 3.9 KB checked in by root, 17 years ago (diff)

new import

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