그래프 그리기 입니다.

· 10년 전 · 2017

<?

# 그래프 출력을 위한 데이터의 최대값및 최소값 세팅
$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년 전 조회 2,275
9년 전 조회 2,344
9년 전 조회 2,085
9년 전 조회 1,910
9년 전 조회 1,963
9년 전 조회 2,314
9년 전 조회 1,847
10년 전 조회 2,110
10년 전 조회 1,900
10년 전 조회 2,022
10년 전 조회 1,876
10년 전 조회 2,135
10년 전 조회 1,836
10년 전 조회 1,814
10년 전 조회 1,814
10년 전 조회 1,893
10년 전 조회 1,845
10년 전 조회 1,845
10년 전 조회 1,981
10년 전 조회 1,762
10년 전 조회 1,796
10년 전 조회 1,829
10년 전 조회 1,947
10년 전 조회 1,786
10년 전 조회 1,926
10년 전 조회 1,686
10년 전 조회 1,795
10년 전 조회 1,571
10년 전 조회 1,829
10년 전 조회 1,610
10년 전 조회 1,677
10년 전 조회 1,771
10년 전 조회 1,661
10년 전 조회 1,697
10년 전 조회 1,646
10년 전 조회 2,064
10년 전 조회 2,066
10년 전 조회 2,060
10년 전 조회 2,016
10년 전 조회 1,803
10년 전 조회 1,926
10년 전 조회 2,075
10년 전 조회 1,782
10년 전 조회 2,080
10년 전 조회 2,032
10년 전 조회 2,423
10년 전 조회 2,034
10년 전 조회 2,244
10년 전 조회 1,863
10년 전 조회 2,018
10년 전 조회 1,703
10년 전 조회 1,792
10년 전 조회 1,826
10년 전 조회 1,830
10년 전 조회 1,993
10년 전 조회 1,763
10년 전 조회 1,783
10년 전 조회 1,801
10년 전 조회 1,699
10년 전 조회 1,754
10년 전 조회 1,560
10년 전 조회 1,632
10년 전 조회 1,548
10년 전 조회 1,719
10년 전 조회 1,660
10년 전 조회 2,129
10년 전 조회 1,604
10년 전 조회 1,564
10년 전 조회 1,839
10년 전 조회 1,638
10년 전 조회 1,588
10년 전 조회 1,604
10년 전 조회 1,573
10년 전 조회 1,482
10년 전 조회 1,464
10년 전 조회 1,581
10년 전 조회 1,544
10년 전 조회 1,508
10년 전 조회 1,404
10년 전 조회 1,467
10년 전 조회 1,513
10년 전 조회 1,483
10년 전 조회 1,555
10년 전 조회 1,519
10년 전 조회 1,485
10년 전 조회 1,485
10년 전 조회 1,526
10년 전 조회 1,504
10년 전 조회 1,585
10년 전 조회 1,499
10년 전 조회 1,442
10년 전 조회 1,414
10년 전 조회 1,434
10년 전 조회 1,468
10년 전 조회 1,448
10년 전 조회 1,477
10년 전 조회 1,421
10년 전 조회 1,490
10년 전 조회 1,437
10년 전 조회 1,515