COMING SOON 🚀

그래프 그리기 입니다.

· 10년 전 · 1690

<?

# 그래프 출력을 위한 데이터의 최대값및 최소값 세팅
$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,908
9년 전 조회 1,949
9년 전 조회 1,682
9년 전 조회 1,551
9년 전 조회 1,600
9년 전 조회 1,942
9년 전 조회 1,519
9년 전 조회 1,760
9년 전 조회 1,583
9년 전 조회 1,687
9년 전 조회 1,547
9년 전 조회 1,807
9년 전 조회 1,517
9년 전 조회 1,493
9년 전 조회 1,465
9년 전 조회 1,564
9년 전 조회 1,494
9년 전 조회 1,551
9년 전 조회 1,651
9년 전 조회 1,464
9년 전 조회 1,490
10년 전 조회 1,492
10년 전 조회 1,609
10년 전 조회 1,475
10년 전 조회 1,582
10년 전 조회 1,413
10년 전 조회 1,490
10년 전 조회 1,312
10년 전 조회 1,538
10년 전 조회 1,340
10년 전 조회 1,362
10년 전 조회 1,475
10년 전 조회 1,382
10년 전 조회 1,411
10년 전 조회 1,336
10년 전 조회 1,751
10년 전 조회 1,784
10년 전 조회 1,752
10년 전 조회 1,701
10년 전 조회 1,491
10년 전 조회 1,626
10년 전 조회 1,766
10년 전 조회 1,475
10년 전 조회 1,776
10년 전 조회 1,737
10년 전 조회 2,121
10년 전 조회 1,723
10년 전 조회 1,930
10년 전 조회 1,564
10년 전 조회 1,691
10년 전 조회 1,416
10년 전 조회 1,476
10년 전 조회 1,537
10년 전 조회 1,528
10년 전 조회 1,676
10년 전 조회 1,449
10년 전 조회 1,472
10년 전 조회 1,439
10년 전 조회 1,386
10년 전 조회 1,455
10년 전 조회 1,263
10년 전 조회 1,333
10년 전 조회 1,235
10년 전 조회 1,377
10년 전 조회 1,330
10년 전 조회 1,803
10년 전 조회 1,281
10년 전 조회 1,249
10년 전 조회 1,503
10년 전 조회 1,309
10년 전 조회 1,283
10년 전 조회 1,291
10년 전 조회 1,232
10년 전 조회 1,148
10년 전 조회 1,143
10년 전 조회 1,240
10년 전 조회 1,240
10년 전 조회 1,174
10년 전 조회 1,066
10년 전 조회 1,152
10년 전 조회 1,128
10년 전 조회 1,143
10년 전 조회 1,191
10년 전 조회 1,199
10년 전 조회 1,138
10년 전 조회 1,141
10년 전 조회 1,196
10년 전 조회 1,161
10년 전 조회 1,237
10년 전 조회 1,166
10년 전 조회 1,115
10년 전 조회 1,092
10년 전 조회 1,103
10년 전 조회 1,094
10년 전 조회 1,114
10년 전 조회 1,142
10년 전 조회 1,108
10년 전 조회 1,161
10년 전 조회 1,091
10년 전 조회 1,199