그래프 그리기 입니다.

· 9년 전 · 943

<?

# 그래프 출력을 위한 데이터의 최대값및 최소값 세팅
$maxVal = 50;  // 최대값 5백만
$step = 5;   // 단위 5십만


$arrVal = array(25,18, 34, 46, 10, 29, 17, 38, 26, 25, 27, 39, 44, 22, 16, 43, 39, 22, 44, 18, 14, 22, 32, 45);

function showStickGraph($maxVal, $minVal, $step, $arrVal)
{
 $bottomCommentHeight= 30;    // 하단 설명공간 높이 픽셀값
 $cntY = round($maxVal / $step);  // y축 눈금개수
 $unitHight = 30;        // 단위 높이 픽셀값
 $minVal = 0;         // 최소값
 $k= 10;
 
?>
 <table cellpadding=0 cellspacing=0 border="1" >
  <tr>
  
   <!-- y축-->
   <td >
     <table cellpadding=0 cellspacing=0 border="1" >
     
      <? for ($a= $maxVal; $a >= $minVal; $a -= $step){ ?>
      <tr>
       <td height="<?=$unitHight?>" valign="bottom" align="right">
        <font size="2"><?=$a?></font>
       </td>
      </tr>
      <?}?>
     
      <tr>
       <td height="<?=$bottomCommentHeight?>">
        <font size="2">매출<br>(단위:10만)</font></td>
      </tr>
     
     </table>
 
    </td>
  
   <!--x축-->
   <td valign="bottom">
    <table cellpadding=0 cellspacing=0 border="0" >
     <tr>
      <? for ($i= 0; $i < 24; $i++){ ?>
      <td align="center" valign="bottom">
          <table cellpadding=0 cellspacing=0 border="1" >
           <tr>
         <td width="20" height="<?=($arrVal[$i])/$step * $unitHight ?>" bgcolor="green" valign="top" align="center">
          <font size="2" color="white"><b><?=$arrVal[$i]?></b></font></td>
        </tr>
       
        <tr>
         <td height="<?=$bottomCommentHeight?>" valigh="top"><font size="2"><?=($i<10)?"0$i":$i?></font></td>
        </tr>
       </table>
        </td>
        <?}?>
      </tr>
     
     </table>

    </td>
  
  </tr>
 </table>
<?
}
showStickGraph($maxVal, $minVal, $step, $arrVal);
?>
 

|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
9년 전 조회 929
9년 전 조회 976
9년 전 조회 695
9년 전 조회 577
9년 전 조회 620
9년 전 조회 986
9년 전 조회 655
9년 전 조회 852
9년 전 조회 703
9년 전 조회 785
9년 전 조회 675
9년 전 조회 980
9년 전 조회 687
9년 전 조회 665
9년 전 조회 629
9년 전 조회 746
9년 전 조회 662
9년 전 조회 712
9년 전 조회 818
9년 전 조회 607
9년 전 조회 650
9년 전 조회 665
9년 전 조회 793
9년 전 조회 627
9년 전 조회 761
9년 전 조회 555
9년 전 조회 625
9년 전 조회 501
9년 전 조회 693
9년 전 조회 588
9년 전 조회 594
9년 전 조회 649
9년 전 조회 596
9년 전 조회 605
9년 전 조회 585
9년 전 조회 952
9년 전 조회 1,000
9년 전 조회 971
9년 전 조회 929
9년 전 조회 700
9년 전 조회 867
9년 전 조회 991
9년 전 조회 693
9년 전 조회 976
9년 전 조회 936
9년 전 조회 1,354
9년 전 조회 965
9년 전 조회 1,133
9년 전 조회 801
9년 전 조회 944
9년 전 조회 679
9년 전 조회 671
9년 전 조회 794
9년 전 조회 760
9년 전 조회 937
9년 전 조회 660
9년 전 조회 730
9년 전 조회 705
9년 전 조회 614
9년 전 조회 713
9년 전 조회 568
9년 전 조회 610
9년 전 조회 551
9년 전 조회 645
9년 전 조회 624
10년 전 조회 1,077
10년 전 조회 584
10년 전 조회 506
10년 전 조회 780
10년 전 조회 609
10년 전 조회 582
10년 전 조회 557
10년 전 조회 528
10년 전 조회 475
10년 전 조회 452
10년 전 조회 524
10년 전 조회 540
10년 전 조회 495
10년 전 조회 440
10년 전 조회 523
10년 전 조회 509
10년 전 조회 505
10년 전 조회 567
10년 전 조회 577
10년 전 조회 466
10년 전 조회 504
10년 전 조회 569
10년 전 조회 507
10년 전 조회 598
10년 전 조회 532
10년 전 조회 484
10년 전 조회 435
10년 전 조회 485
10년 전 조회 449
10년 전 조회 467
10년 전 조회 504
10년 전 조회 438
10년 전 조회 483
10년 전 조회 446
10년 전 조회 548
🐛 버그신고