그래프 그리기 입니다.

· 10년 전 · 1718

<?

# 그래프 출력을 위한 데이터의 최대값및 최소값 세팅
$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,921
9년 전 조회 1,965
9년 전 조회 1,701
9년 전 조회 1,566
9년 전 조회 1,613
9년 전 조회 1,956
9년 전 조회 1,546
9년 전 조회 1,778
9년 전 조회 1,612
9년 전 조회 1,710
9년 전 조회 1,582
9년 전 조회 1,837
9년 전 조회 1,547
9년 전 조회 1,517
9년 전 조회 1,484
9년 전 조회 1,590
9년 전 조회 1,521
9년 전 조회 1,580
9년 전 조회 1,682
9년 전 조회 1,488
10년 전 조회 1,508
10년 전 조회 1,512
10년 전 조회 1,644
10년 전 조회 1,497
10년 전 조회 1,603
10년 전 조회 1,430
10년 전 조회 1,510
10년 전 조회 1,334
10년 전 조회 1,555
10년 전 조회 1,367
10년 전 조회 1,393
10년 전 조회 1,500
10년 전 조회 1,398
10년 전 조회 1,430
10년 전 조회 1,362
10년 전 조회 1,772
10년 전 조회 1,809
10년 전 조회 1,769
10년 전 조회 1,728
10년 전 조회 1,510
10년 전 조회 1,646
10년 전 조회 1,799
10년 전 조회 1,504
10년 전 조회 1,804
10년 전 조회 1,763
10년 전 조회 2,151
10년 전 조회 1,760
10년 전 조회 1,961
10년 전 조회 1,590
10년 전 조회 1,719
10년 전 조회 1,442
10년 전 조회 1,504
10년 전 조회 1,563
10년 전 조회 1,555
10년 전 조회 1,705
10년 전 조회 1,473
10년 전 조회 1,504
10년 전 조회 1,471
10년 전 조회 1,412
10년 전 조회 1,478
10년 전 조회 1,292
10년 전 조회 1,364
10년 전 조회 1,272
10년 전 조회 1,407
10년 전 조회 1,359
10년 전 조회 1,835
10년 전 조회 1,309
10년 전 조회 1,278
10년 전 조회 1,534
10년 전 조회 1,343
10년 전 조회 1,314
10년 전 조회 1,320
10년 전 조회 1,260
10년 전 조회 1,191
10년 전 조회 1,175
10년 전 조회 1,270
10년 전 조회 1,265
10년 전 조회 1,196
10년 전 조회 1,094
10년 전 조회 1,179
10년 전 조회 1,154
10년 전 조회 1,174
10년 전 조회 1,234
10년 전 조회 1,230
10년 전 조회 1,169
10년 전 조회 1,175
10년 전 조회 1,221
10년 전 조회 1,191
10년 전 조회 1,263
10년 전 조회 1,189
10년 전 조회 1,135
10년 전 조회 1,117
10년 전 조회 1,139
10년 전 조회 1,115
10년 전 조회 1,144
10년 전 조회 1,160
10년 전 조회 1,131
10년 전 조회 1,181
10년 전 조회 1,127
10년 전 조회 1,216