그래프 그리기 입니다.

· 10년 전 · 1595

<?

# 그래프 출력을 위한 데이터의 최대값및 최소값 세팅
$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,825
9년 전 조회 1,857
9년 전 조회 1,604
9년 전 조회 1,479
9년 전 조회 1,529
9년 전 조회 1,862
9년 전 조회 1,426
9년 전 조회 1,654
9년 전 조회 1,496
9년 전 조회 1,587
9년 전 조회 1,463
9년 전 조회 1,727
9년 전 조회 1,436
9년 전 조회 1,404
9년 전 조회 1,376
9년 전 조회 1,471
9년 전 조회 1,382
9년 전 조회 1,456
9년 전 조회 1,549
9년 전 조회 1,366
9년 전 조회 1,399
9년 전 조회 1,389
9년 전 조회 1,521
9년 전 조회 1,381
9년 전 조회 1,490
9년 전 조회 1,332
9년 전 조회 1,399
9년 전 조회 1,230
9년 전 조회 1,454
9년 전 조회 1,273
9년 전 조회 1,276
9년 전 조회 1,371
10년 전 조회 1,300
10년 전 조회 1,319
10년 전 조회 1,239
10년 전 조회 1,652
10년 전 조회 1,704
10년 전 조회 1,671
10년 전 조회 1,608
10년 전 조회 1,397
10년 전 조회 1,539
10년 전 조회 1,680
10년 전 조회 1,366
10년 전 조회 1,681
10년 전 조회 1,654
10년 전 조회 2,023
10년 전 조회 1,627
10년 전 조회 1,842
10년 전 조회 1,479
10년 전 조회 1,596
10년 전 조회 1,330
10년 전 조회 1,384
10년 전 조회 1,454
10년 전 조회 1,447
10년 전 조회 1,583
10년 전 조회 1,363
10년 전 조회 1,398
10년 전 조회 1,345
10년 전 조회 1,317
10년 전 조회 1,357
10년 전 조회 1,206
10년 전 조회 1,248
10년 전 조회 1,171
10년 전 조회 1,295
10년 전 조회 1,250
10년 전 조회 1,724
10년 전 조회 1,210
10년 전 조회 1,172
10년 전 조회 1,418
10년 전 조회 1,225
10년 전 조회 1,200
10년 전 조회 1,203
10년 전 조회 1,158
10년 전 조회 1,088
10년 전 조회 1,071
10년 전 조회 1,163
10년 전 조회 1,168
10년 전 조회 1,097
10년 전 조회 994
10년 전 조회 1,077
10년 전 조회 1,047
10년 전 조회 1,082
10년 전 조회 1,125
10년 전 조회 1,114
10년 전 조회 1,067
10년 전 조회 1,074
10년 전 조회 1,131
10년 전 조회 1,079
10년 전 조회 1,165
10년 전 조회 1,103
10년 전 조회 1,037
10년 전 조회 1,007
10년 전 조회 1,038
10년 전 조회 995
10년 전 조회 1,038
10년 전 조회 1,071
10년 전 조회 1,018
10년 전 조회 1,085
10년 전 조회 1,034
10년 전 조회 1,121