웹마스터 팁

미리보기 : http://sjbiz.net/house/a.php

phpschool에서 어떤분이 3차원 그래프를 올려 놓으셨길래 함 따라해 봤어여 ^^;
( 그분이 소스를 안 올려 주셔서 ㅡ.ㅜ )
디자인은 그분꺼 그대루...
이거 근데 생각보다 디게 노가대 네여
무려 8시간이나 ㅡ.,ㅡ;;
내용은 매월 수익과 지출을 그래프로 나타낸 겁니다.
디비와 연결 없이 for 로 난수를 적용하여 그래프 만든겁니다 ^^;
그럼...

<?
header("Content-Type : image/png");
function printPolygon($num, $color, $x1,$y1,$x2,$y2,$x3=0,$y3=0,$x4=0,$y4=0,$x5=0,$y5=0,$x6=0,$y6=0){
        global $im;

        $points[0]=$x1; $points[1]=$y1;
        $points[2]=$x2; $points[3]=$y2;
        $points[4]=$x3; $points[5]=$y3;
        $points[6]=$x4; $points[7]=$y4;
        $points[8]=$x5; $points[9]=$y5;
        $points[10]=$x6; $points[11]=$y6;

        ImageFilledPolygon($im,$points,$num,$color);
}

$im=ImageCreate(663,403);
$black=ImageColorAllocate($im,0,0,0);
$white=ImageColorAllocate($im,255,255,255);
$fb1=ImageColorAllocate($im,192,192,192);
$fb2=ImageColorAllocate($im,130,130,130);
$fb3=ImageColorAllocate($im,240,240,240);
$g1=ImageColorAllocate($im,0,153,51);
$g2=ImageColorAllocate($im,0,115,39);
$g3=ImageColorAllocate($im,0,77,26);
$gr1=ImageColorAllocate($im,153,0,0);
$gr2=ImageColorAllocate($im,115,0,0);
$gr3=ImageColorAllocate($im,77,0,0);

printPolygon(4,$white,2,2,657,2,657,397,2,397); //배경 만들기
imagefilledrectangle($im,0,400,5,403,$white); //왼쪽 아래 조그만 흰색 사각형
imagefilledrectangle($im,660,0,663,5,$white); //오른쪽 상단 조그만 흰색 사각형

//실제 그래프 모양 만들기
printPolygon(6,$fb1,65,25,630,25,630,265,610,285,45,285,45,45); //배경 다각형
printPolygon(6,$fb2,630,25,630,265,610,285,610,277,625,261,625,30); //오른쪽 모서리 다각형
printPolygon(6,$fb3,45,45,51,45,51,277,610,277,610,285,45,285); //축 배경
printPolygon(4,$fb2,52,45,67,29,67,262,52,276); //Y축 배경 안쪽
printPolygon(4,$fb3,68,30,624,30,624,261,68,261); //배경 다각형 안쪽 배경

//축 기준 값들 (점선)
for ($i=52; $i<242; $i+=21) imageLine($im,68,$i,624,$i,$black);
for ($i=52; $i<242; $i+=21) imageLine($im,52,$i+15,67,$i,$fb3);
for ($i=68; $i<258; $i+=21) imageLine($im,45,$i,50,$i,$black);



for ($i=20; $i<466; $i+=15){
        if(!$j)$j=1;
        imageLine($im,$i+93,277,$i+93,285,$black);

        $y=rand(100,276);
        imagefilledrectangle($im,$i+80,$y,$i+90,276,$g1); //값 표면
        printPolygon(4,$g2,$i+80,$y,$i+95,$y-15,$i+105,$y-15,$i+90,$y); //값 안쪽
        printPolygon(4,$g3,$i+90,$y,$i+105,$y-15,$i+105,261,$i+90,276); //값 오른쪽

        $y=rand(100,276);
        $i+=15;
        imagefilledrectangle($im,$i+80,$y,$i+90,276,$gr1); //값 표면
        printPolygon(4,$gr2,$i+80,$y,$i+95,$y-15,$i+105,$y-15,$i+90,$y); //값 안쪽
        printPolygon(4,$gr3,$i+90,$y,$i+105,$y-15,$i+105,261,$i+90,276); //값 오른쪽

        $i+=10;

        Imagestring($im,2,$i+66,286,$j,$black);
        $j++;
}

imagefilledrectangle($im,440,320,632,372,$fb2); //주석 상자 테두리
imagefilledrectangle($im,442,322,630,370,$white); //주석 상자
imagefilledrectangle($im,450,332,460,342,$g1); //수입 상자
imagefilledrectangle($im,450,352,460,362,$gr1); //지출 상자
Imagestring($im,2,470,330,': the amount of imports.'+ ',$black);
Imagestring($im,2,470,350,': the amount disbursed.',$black);

Imagestring($im,5,150,7,'2002 Year, monthly expenses graph.',$black); //타이틀 적기

$file="per_day.png";

ImageInterlace($im,1);
Imagepng($im);
//Imagepng($im,$file);
ImageDestroy($im);
?>
제목 글쓴이 날짜
[추천 팁] 폴더내의 파일중에서 특정정보만 뽑아오기. [2] M2Vis 2002.07.12
[추천 팁] 파일의 최종접근시간과 파일의 수정시간을 알려주는 함수 [2] ssukai 2002.07.10
PHP 와 Flash 를 이용해 즉석복권을 만들어 보자. [2] 다솜아빠 2002.07.10
[추천 팁] 웹 브라우저가 한글인지 영문인지(다른 언어인지) 자동 인식하기... [1] 박용구 2002.07.10
[PHP]간단한 로그인페이지 만들기 [15] ZipShin 2002.07.09
php소스를 윈도우 실행파일로 만드는 컴파일러 있나요? [2] 소우리 2002.07.08
배경그림과 글자색상,배경색상을 지정해주는 php스크립트 [2] ZipShin 2002.07.07
echo를 처음사용하시는 초보들에게... [10] ZipShin 2002.07.06
HTML 태그 메일 전송하기 [2] ZipShin 2002.07.06
EMail 주소 검사하기 [6] ZipShin 2002.07.06
트리뷰를 흉내낸 클래스 입니다.^^;; 용가리 2002.06.24
위 짜가리 클래스 활용 1 (FTP 디렉토리 트리뷰) 용가리 2002.06.24
위 짜가리 클래스 활용 1 (디렉토리 트리뷰) 용가리 2002.06.24
트리뷰를 흉내낸 클래스 사용법 입니다.^^;; 용가리 2002.06.24
리스트뷰를 흉내낸 클래스 입니다.^^;; [2] 용가리 2002.06.22
위의 리스트뷰 흉내낸 클래스 활용법 입니다.^^; [1] 용가리 2002.06.22
위의 리스트뷰 흉내낸 클래스 사용법 입니다.^^; 용가리 2002.06.22
php에서 GD를 이용한 3차원 막대 그래프 입니다. [4] 용가리 2002.06.22
리눅스로 쉘 프로그래밍 할때 [1] OsE= 2002.06.19
[mysql] 하나 더 추가요. 역시 별로 쓸대 없는거... 불티나 2002.06.18