그래프 그리기 입니다.

· 10년 전 · 1899

<?

# 그래프 출력을 위한 데이터의 최대값및 최소값 세팅
$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,043
9년 전 조회 2,091
9년 전 조회 1,848
9년 전 조회 1,684
9년 전 조회 1,730
9년 전 조회 2,079
9년 전 조회 1,670
9년 전 조회 1,934
9년 전 조회 1,754
9년 전 조회 1,865
10년 전 조회 1,731
10년 전 조회 1,987
10년 전 조회 1,686
10년 전 조회 1,666
10년 전 조회 1,666
10년 전 조회 1,742
10년 전 조회 1,695
10년 전 조회 1,705
10년 전 조회 1,840
10년 전 조회 1,620
10년 전 조회 1,632
10년 전 조회 1,679
10년 전 조회 1,805
10년 전 조회 1,641
10년 전 조회 1,775
10년 전 조회 1,564
10년 전 조회 1,656
10년 전 조회 1,452
10년 전 조회 1,692
10년 전 조회 1,483
10년 전 조회 1,543
10년 전 조회 1,644
10년 전 조회 1,538
10년 전 조회 1,578
10년 전 조회 1,515
10년 전 조회 1,915
10년 전 조회 1,933
10년 전 조회 1,922
10년 전 조회 1,886
10년 전 조회 1,669
10년 전 조회 1,790
10년 전 조회 1,962
10년 전 조회 1,658
10년 전 조회 1,947
10년 전 조회 1,919
10년 전 조회 2,294
10년 전 조회 1,908
10년 전 조회 2,121
10년 전 조회 1,725
10년 전 조회 1,900
10년 전 조회 1,595
10년 전 조회 1,674
10년 전 조회 1,707
10년 전 조회 1,714
10년 전 조회 1,883
10년 전 조회 1,644
10년 전 조회 1,679
10년 전 조회 1,679
10년 전 조회 1,593
10년 전 조회 1,646
10년 전 조회 1,460
10년 전 조회 1,535
10년 전 조회 1,451
10년 전 조회 1,599
10년 전 조회 1,552
10년 전 조회 2,015
10년 전 조회 1,485
10년 전 조회 1,457
10년 전 조회 1,718
10년 전 조회 1,521
10년 전 조회 1,494
10년 전 조회 1,493
10년 전 조회 1,453
10년 전 조회 1,381
10년 전 조회 1,349
10년 전 조회 1,475
10년 전 조회 1,449
10년 전 조회 1,396
10년 전 조회 1,279
10년 전 조회 1,364
10년 전 조회 1,385
10년 전 조회 1,383
10년 전 조회 1,431
10년 전 조회 1,421
10년 전 조회 1,369
10년 전 조회 1,370
10년 전 조회 1,423
10년 전 조회 1,389
10년 전 조회 1,483
10년 전 조회 1,385
10년 전 조회 1,346
10년 전 조회 1,312
10년 전 조회 1,341
10년 전 조회 1,352
10년 전 조회 1,353
10년 전 조회 1,369
10년 전 조회 1,319
10년 전 조회 1,387
10년 전 조회 1,321
10년 전 조회 1,420