그래프 그리기 입니다.

· 10년 전 · 1766

<?

# 그래프 출력을 위한 데이터의 최대값및 최소값 세팅
$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,935
9년 전 조회 1,984
9년 전 조회 1,719
9년 전 조회 1,577
9년 전 조회 1,633
9년 전 조회 1,981
9년 전 조회 1,568
9년 전 조회 1,808
9년 전 조회 1,635
9년 전 조회 1,740
9년 전 조회 1,608
9년 전 조회 1,869
9년 전 조회 1,577
9년 전 조회 1,544
9년 전 조회 1,519
9년 전 조회 1,625
9년 전 조회 1,565
9년 전 조회 1,609
10년 전 조회 1,707
10년 전 조회 1,513
10년 전 조회 1,530
10년 전 조회 1,543
10년 전 조회 1,677
10년 전 조회 1,527
10년 전 조회 1,625
10년 전 조회 1,459
10년 전 조회 1,542
10년 전 조회 1,362
10년 전 조회 1,577
10년 전 조회 1,386
10년 전 조회 1,423
10년 전 조회 1,530
10년 전 조회 1,426
10년 전 조회 1,466
10년 전 조회 1,397
10년 전 조회 1,807
10년 전 조회 1,833
10년 전 조회 1,802
10년 전 조회 1,761
10년 전 조회 1,536
10년 전 조회 1,673
10년 전 조회 1,843
10년 전 조회 1,553
10년 전 조회 1,839
10년 전 조회 1,808
10년 전 조회 2,181
10년 전 조회 1,794
10년 전 조회 1,992
10년 전 조회 1,627
10년 전 조회 1,767
10년 전 조회 1,479
10년 전 조회 1,537
10년 전 조회 1,596
10년 전 조회 1,582
10년 전 조회 1,738
10년 전 조회 1,502
10년 전 조회 1,540
10년 전 조회 1,523
10년 전 조회 1,444
10년 전 조회 1,517
10년 전 조회 1,330
10년 전 조회 1,397
10년 전 조회 1,309
10년 전 조회 1,456
10년 전 조회 1,395
10년 전 조회 1,877
10년 전 조회 1,344
10년 전 조회 1,306
10년 전 조회 1,568
10년 전 조회 1,371
10년 전 조회 1,355
10년 전 조회 1,348
10년 전 조회 1,292
10년 전 조회 1,224
10년 전 조회 1,201
10년 전 조회 1,304
10년 전 조회 1,300
10년 전 조회 1,230
10년 전 조회 1,126
10년 전 조회 1,208
10년 전 조회 1,190
10년 전 조회 1,207
10년 전 조회 1,261
10년 전 조회 1,266
10년 전 조회 1,204
10년 전 조회 1,208
10년 전 조회 1,247
10년 전 조회 1,224
10년 전 조회 1,305
10년 전 조회 1,214
10년 전 조회 1,173
10년 전 조회 1,155
10년 전 조회 1,167
10년 전 조회 1,147
10년 전 조회 1,176
10년 전 조회 1,186
10년 전 조회 1,157
10년 전 조회 1,223
10년 전 조회 1,153
10년 전 조회 1,247