그래프 그리기 입니다.

· 10년 전 · 1020

<?

# 그래프 출력을 위한 데이터의 최대값및 최소값 세팅
$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년 전 조회 1,006
9년 전 조회 1,061
9년 전 조회 790
9년 전 조회 638
9년 전 조회 705
9년 전 조회 1,064
9년 전 조회 726
9년 전 조회 929
9년 전 조회 779
9년 전 조회 862
9년 전 조회 760
9년 전 조회 1,048
9년 전 조회 765
9년 전 조회 740
9년 전 조회 709
9년 전 조회 809
9년 전 조회 714
9년 전 조회 797
9년 전 조회 900
9년 전 조회 681
9년 전 조회 723
9년 전 조회 734
9년 전 조회 873
9년 전 조회 703
9년 전 조회 832
9년 전 조회 633
9년 전 조회 713
9년 전 조회 560
9년 전 조회 768
9년 전 조회 654
9년 전 조회 675
9년 전 조회 732
9년 전 조회 679
9년 전 조회 692
9년 전 조회 663
9년 전 조회 1,030
9년 전 조회 1,072
9년 전 조회 1,058
9년 전 조회 999
9년 전 조회 788
9년 전 조회 945
9년 전 조회 1,071
9년 전 조회 774
9년 전 조회 1,061
9년 전 조회 1,020
10년 전 조회 1,431
10년 전 조회 1,036
10년 전 조회 1,230
10년 전 조회 855
10년 전 조회 1,021
10년 전 조회 732
10년 전 조회 755
10년 전 조회 882
10년 전 조회 846
10년 전 조회 1,004
10년 전 조회 741
10년 전 조회 806
10년 전 조회 776
10년 전 조회 686
10년 전 조회 795
10년 전 조회 638
10년 전 조회 693
10년 전 조회 624
10년 전 조회 712
10년 전 조회 687
10년 전 조회 1,139
10년 전 조회 662
10년 전 조회 592
10년 전 조회 853
10년 전 조회 673
10년 전 조회 646
10년 전 조회 652
10년 전 조회 603
10년 전 조회 549
10년 전 조회 526
10년 전 조회 602
10년 전 조회 619
10년 전 조회 570
10년 전 조회 512
10년 전 조회 601
10년 전 조회 576
10년 전 조회 584
10년 전 조회 638
10년 전 조회 649
10년 전 조회 543
10년 전 조회 579
10년 전 조회 639
10년 전 조회 579
10년 전 조회 667
10년 전 조회 606
10년 전 조회 551
10년 전 조회 525
10년 전 조회 556
10년 전 조회 518
10년 전 조회 546
10년 전 조회 586
10년 전 조회 520
10년 전 조회 564
10년 전 조회 530
10년 전 조회 621