그래프 그리기 입니다.

· 10년 전 · 1821

<?

# 그래프 출력을 위한 데이터의 최대값및 최소값 세팅
$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,956
9년 전 조회 2,017
9년 전 조회 1,760
9년 전 조회 1,607
9년 전 조회 1,666
9년 전 조회 2,010
9년 전 조회 1,604
9년 전 조회 1,860
9년 전 조회 1,665
9년 전 조회 1,785
9년 전 조회 1,649
9년 전 조회 1,913
9년 전 조회 1,614
9년 전 조회 1,586
9년 전 조회 1,580
10년 전 조회 1,668
10년 전 조회 1,612
10년 전 조회 1,649
10년 전 조회 1,761
10년 전 조회 1,552
10년 전 조회 1,571
10년 전 조회 1,597
10년 전 조회 1,724
10년 전 조회 1,574
10년 전 조회 1,682
10년 전 조회 1,495
10년 전 조회 1,580
10년 전 조회 1,399
10년 전 조회 1,619
10년 전 조회 1,418
10년 전 조회 1,461
10년 전 조회 1,572
10년 전 조회 1,475
10년 전 조회 1,508
10년 전 조회 1,434
10년 전 조회 1,847
10년 전 조회 1,876
10년 전 조회 1,854
10년 전 조회 1,815
10년 전 조회 1,596
10년 전 조회 1,718
10년 전 조회 1,889
10년 전 조회 1,601
10년 전 조회 1,874
10년 전 조회 1,853
10년 전 조회 2,232
10년 전 조회 1,834
10년 전 조회 2,040
10년 전 조회 1,676
10년 전 조회 1,822
10년 전 조회 1,528
10년 전 조회 1,594
10년 전 조회 1,641
10년 전 조회 1,629
10년 전 조회 1,799
10년 전 조회 1,570
10년 전 조회 1,593
10년 전 조회 1,600
10년 전 조회 1,514
10년 전 조회 1,572
10년 전 조회 1,383
10년 전 조회 1,459
10년 전 조회 1,358
10년 전 조회 1,520
10년 전 조회 1,466
10년 전 조회 1,939
10년 전 조회 1,405
10년 전 조회 1,370
10년 전 조회 1,633
10년 전 조회 1,433
10년 전 조회 1,410
10년 전 조회 1,407
10년 전 조회 1,359
10년 전 조회 1,294
10년 전 조회 1,265
10년 전 조회 1,384
10년 전 조회 1,350
10년 전 조회 1,307
10년 전 조회 1,196
10년 전 조회 1,275
10년 전 조회 1,257
10년 전 조회 1,283
10년 전 조회 1,334
10년 전 조회 1,324
10년 전 조회 1,281
10년 전 조회 1,281
10년 전 조회 1,309
10년 전 조회 1,295
10년 전 조회 1,368
10년 전 조회 1,282
10년 전 조회 1,237
10년 전 조회 1,217
10년 전 조회 1,239
10년 전 조회 1,235
10년 전 조회 1,242
10년 전 조회 1,261
10년 전 조회 1,217
10년 전 조회 1,276
10년 전 조회 1,213
10년 전 조회 1,313