그래프 그리기 입니다.

· 10년 전 · 1071

<?

# 그래프 출력을 위한 데이터의 최대값및 최소값 세팅
$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,025
9년 전 조회 1,083
9년 전 조회 809
9년 전 조회 664
9년 전 조회 732
9년 전 조회 1,087
9년 전 조회 741
9년 전 조회 954
9년 전 조회 803
9년 전 조회 893
9년 전 조회 776
9년 전 조회 1,071
9년 전 조회 795
9년 전 조회 767
9년 전 조회 732
9년 전 조회 841
9년 전 조회 744
9년 전 조회 821
9년 전 조회 929
9년 전 조회 707
9년 전 조회 757
9년 전 조회 767
9년 전 조회 899
9년 전 조회 739
9년 전 조회 867
9년 전 조회 660
9년 전 조회 753
9년 전 조회 593
9년 전 조회 802
9년 전 조회 689
9년 전 조회 706
9년 전 조회 777
9년 전 조회 718
9년 전 조회 727
9년 전 조회 698
9년 전 조회 1,071
9년 전 조회 1,104
9년 전 조회 1,089
9년 전 조회 1,039
9년 전 조회 833
9년 전 조회 987
9년 전 조회 1,117
9년 전 조회 802
10년 전 조회 1,098
10년 전 조회 1,071
10년 전 조회 1,472
10년 전 조회 1,091
10년 전 조회 1,274
10년 전 조회 915
10년 전 조회 1,072
10년 전 조회 785
10년 전 조회 818
10년 전 조회 926
10년 전 조회 896
10년 전 조회 1,050
10년 전 조회 794
10년 전 조회 856
10년 전 조회 825
10년 전 조회 749
10년 전 조회 841
10년 전 조회 694
10년 전 조회 749
10년 전 조회 672
10년 전 조회 761
10년 전 조회 745
10년 전 조회 1,184
10년 전 조회 713
10년 전 조회 661
10년 전 조회 912
10년 전 조회 730
10년 전 조회 702
10년 전 조회 714
10년 전 조회 672
10년 전 조회 612
10년 전 조회 588
10년 전 조회 669
10년 전 조회 674
10년 전 조회 628
10년 전 조회 574
10년 전 조회 661
10년 전 조회 643
10년 전 조회 642
10년 전 조회 704
10년 전 조회 700
10년 전 조회 597
10년 전 조회 646
10년 전 조회 711
10년 전 조회 640
10년 전 조회 740
10년 전 조회 665
10년 전 조회 615
10년 전 조회 591
10년 전 조회 624
10년 전 조회 593
10년 전 조회 615
10년 전 조회 645
10년 전 조회 591
10년 전 조회 631
10년 전 조회 596
10년 전 조회 688