그래프 그리기 입니다.

· 10년 전 · 1817

<?

# 그래프 출력을 위한 데이터의 최대값및 최소값 세팅
$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,955
9년 전 조회 2,012
9년 전 조회 1,760
9년 전 조회 1,607
9년 전 조회 1,663
9년 전 조회 2,006
9년 전 조회 1,601
9년 전 조회 1,852
9년 전 조회 1,663
9년 전 조회 1,782
9년 전 조회 1,647
9년 전 조회 1,912
9년 전 조회 1,610
9년 전 조회 1,580
9년 전 조회 1,571
10년 전 조회 1,661
10년 전 조회 1,607
10년 전 조회 1,643
10년 전 조회 1,756
10년 전 조회 1,546
10년 전 조회 1,569
10년 전 조회 1,591
10년 전 조회 1,719
10년 전 조회 1,570
10년 전 조회 1,676
10년 전 조회 1,489
10년 전 조회 1,575
10년 전 조회 1,394
10년 전 조회 1,617
10년 전 조회 1,412
10년 전 조회 1,456
10년 전 조회 1,565
10년 전 조회 1,471
10년 전 조회 1,506
10년 전 조회 1,429
10년 전 조회 1,843
10년 전 조회 1,871
10년 전 조회 1,850
10년 전 조회 1,808
10년 전 조회 1,591
10년 전 조회 1,714
10년 전 조회 1,882
10년 전 조회 1,595
10년 전 조회 1,870
10년 전 조회 1,850
10년 전 조회 2,227
10년 전 조회 1,828
10년 전 조회 2,037
10년 전 조회 1,671
10년 전 조회 1,818
10년 전 조회 1,517
10년 전 조회 1,585
10년 전 조회 1,637
10년 전 조회 1,627
10년 전 조회 1,789
10년 전 조회 1,559
10년 전 조회 1,587
10년 전 조회 1,597
10년 전 조회 1,506
10년 전 조회 1,567
10년 전 조회 1,379
10년 전 조회 1,456
10년 전 조회 1,354
10년 전 조회 1,517
10년 전 조회 1,463
10년 전 조회 1,930
10년 전 조회 1,398
10년 전 조회 1,366
10년 전 조회 1,626
10년 전 조회 1,428
10년 전 조회 1,403
10년 전 조회 1,400
10년 전 조회 1,354
10년 전 조회 1,285
10년 전 조회 1,256
10년 전 조회 1,376
10년 전 조회 1,347
10년 전 조회 1,300
10년 전 조회 1,191
10년 전 조회 1,269
10년 전 조회 1,249
10년 전 조회 1,280
10년 전 조회 1,320
10년 전 조회 1,318
10년 전 조회 1,275
10년 전 조회 1,270
10년 전 조회 1,304
10년 전 조회 1,287
10년 전 조회 1,362
10년 전 조회 1,272
10년 전 조회 1,228
10년 전 조회 1,212
10년 전 조회 1,224
10년 전 조회 1,224
10년 전 조회 1,237
10년 전 조회 1,251
10년 전 조회 1,211
10년 전 조회 1,267
10년 전 조회 1,204
10년 전 조회 1,303