Google Chart를 이용한 통계 게시판 > 그누보드5 스킨

그누보드5 스킨

좋은 댓글과 좋아요는 제작자에게 큰힘이 됩니다.

Google Chart를 이용한 통계 게시판 정보

게시판 Google Chart를 이용한 통계 게시판

첨부파일

staitistics.zip (70.8K) 24회 다운로드 2022-12-09 02:00:32 포인트 차감10
테스트한 버전5.4.22
호환 가능 버전5.3이상 가능할 것 같습니다

본문

Google Chart를 게시판에 넣어 보았습니다.

압축을 풀면 statistics_pc, statistics_mobile 폴더가 나옵니다.

그누보드 순정기준으로 

statistics_pc은 skin/board/statistics_pc 경로가 되게 업로드합니다.

statistics_mobile은 mobile/skin/board/statistics_mobile 경로가 되게 업로드합니다.

업로드후 일반적인 방법으로 게시판을 적용하면 됩니다.

 

필요한 만큼 phyMyAdmin를 이용하여 여분필드를 만들어 줍니다.

3529456494_1670500791.4948.png

 

write_update.skin.php에서 추가한 여분필드 만큼 다음 코드를 넣어줍니다.

<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$sql = " update $write_table
            set wr_11 = '$wr_11',
                 wr_12 = '$wr_12',
                 wr_13 = '$wr_13',
                 wr_14 = '$wr_14',
                 wr_15 = '$wr_15',
                 wr_16 = '$wr_16',
                 wr_17 = '$wr_17',
                 wr_18 = '$wr_18',
                 wr_19 = '$wr_19',
                 wr_20 = '$wr_20'
          where wr_id = '$wr_id' ";
sql_query($sql);
?>

 

 

글쓰기입니다.

3529456494_1670520092.2886.png

통계 제목: 표시하려는 통계의 이름을 넣어줍니다.

통계 단위: 표시하려는 단위이름을 넣어줍니다 예: 군사력지수 

라디오버튼으로 표시방법을 정합니다. bar형과 pie형 중에서 선택합니다.

bar형은 막대 그래프타입이고, pie형은 원형 그래프타입니다.

변수이름은 텍스트를 입력합니다.

변수값은 숫자를 입력합니다.

편의상 변수 5개 까지는 필수입력으로 했고 그후는 선택으로 했습니다.

 

구글차트 코드에 필요한 부분을 여분필드로 담았습니다.

<!DOCTYPE html>
<html>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<body>
<div id="myChart" style="width:100%; max-width:600px; height:500px;"></div>
<script>
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
  ['Contry', 'Mhl'],
  ['Italy',55],
  ['France',49],
  ['Spain',44],
  ['USA',24],
  ['Argentina',15]
]);
var options = {
  title:'World Wide Wine Production'
};
var chart = new google.visualization.BarChart(document.getElementById('myChart'));
  chart.draw(data, options);
}
</script>
</body>
</html>

 

view.skin.php 여분필드로 받아오기

<!-- 통계 시작     -->
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<div id="myChart" style="width:100%; max-width:960px; height:500px;"> </div>
<script>
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
  ['Contry', '<?php echo $view['wr_18'];?>'],
  ['<?php echo $view['wr_1'];?>',<?php echo $view['wr_2'];?>],
  ['<?php echo $view['wr_3'];?>',<?php echo $view['wr_4'];?>],
  ['<?php echo $view['wr_5'];?>',<?php echo $view['wr_6'];?>],
  ['<?php echo $view['wr_7'];?>',<?php echo $view['wr_8'];?>],
  ['<?php echo $view['wr_9'];?>',<?php echo $view['wr_10'];?>],
  ['<?php echo $view['wr_11'];?>',<?php echo $view['wr_12'];?>],
  ['<?php echo $view['wr_13'];?>',<?php echo $view['wr_14'];?>]
]);
var options = {
  title:'<?php echo $view['wr_20'];?>',
  is3D:true
};
var chart = new google.visualization.<?php echo $view['wr_19'];?>Chart(document.getElementById('myChart'));
  chart.draw(data, options);
}
</script>
<!-- 통계 종료  -->

 

write.skin.php

<!--  insert graph start -->
      <div class="bo_w_info write_div">
        <label for="wr_20" class="sound_only">통계제목<strong>필수</strong></label>
          <input type="text" name="wr_20" value="<?php echo $write['wr_20'] ?>" id="wr_20" required class="frm_input full_input required" placeholder="통계 제목">
        
        <label for="wr_18" class="sound_only">통계단위<strong>필수</strong></label>
          <input type="text" name="wr_18" value="<?php echo $write['wr_18'] ?>" id="wr_18" required class="frm_input full_input required" placeholder="통계 단위">
        
        <label for="wr_19" class="sound_only">그래픽종류<strong>필수</strong></label>
          <?php echo wr_radio("wr_19", "Bar,Pie", 1); ?>
      </div>
      
      <div class="bo_w_info write_div">
        <label for="wr_1" class="sound_only">1변수이름<strong>필수</strong></label>
          <input type="text" name="wr_1" value="<?php echo $write['wr_1'] ?>" id="wr_1" required class="frm_input half_input required" placeholder="1 변수이름"> 
        <label for="wr_2" class="sound_only">1변수값<strong>필수</strong></label>
          <input style="margin-left: 8px" type="text" name="wr_2" value="<?php echo $write['wr_2'] ?>" id="wr_2" required class="frm_input half_input required" placeholder="1 변수값">
        
              
        
        <label for="wr_3" class="sound_only">2변수이름<strong>필수</strong></label>
          <input type="text" name="wr_3" value="<?php echo $write['wr_3'] ?>" id="wr_3" required class="frm_input half_input required" placeholder="2 변수이름">
 
        <label for="wr_4" class="sound_only">2변수값<strong>필수</strong></label>
          <input style="margin-left: 8px" type="text" name="wr_4" value="<?php echo $write['wr_4'] ?>" id="wr_4" required class="frm_input half_input required" placeholder="2 변수값">
        
              
        
        <label for="wr_5" class="sound_only">3변수이름<strong>필수</strong></label>
          <input type="text" name="wr_5" value="<?php echo $write['wr_5'] ?>" id="wr_5" required class="frm_input half_input required" placeholder="3 변수이름">
 
        <label for="wr_6" class="sound_only">3변수값<strong>필수</strong></label>
          <input style="margin-left: 8px" type="text" name="wr_6" value="<?php echo $write['wr_6'] ?>" id="wr_6" required class="frm_input half_input required" placeholder="3 변수값">
        
            
        
        <label for="wr_7" class="sound_only">4변수이름<strong>필수</strong></label>
          <input type="text" name="wr_7" value="<?php echo $write['wr_7'] ?>" id="wr_7" required class="frm_input half_input required" placeholder="4 변수이름">
 
        <label for="wr_8" class="sound_only">변수값<strong>필수</strong></label>
          <input style="margin-left: 8px" type="text" name="wr_8" value="<?php echo $write['wr_8'] ?>" id="wr_8" required class="frm_input half_input required" placeholder="4 변수값">
        
            
        
        <label for="wr_9" class="sound_only">5변수이름<strong>필수</strong></label>
          <input type="text" name="wr_9" value="<?php echo $write['wr_9'] ?>" id="wr_9" required class="frm_input half_input required" placeholder="5 변수이름">
 
        <label for="wr_10" class="sound_only">5변수값<strong>필수</strong></label>
          <input style="margin-left: 8px" type="text" name="wr_10" value="<?php echo $write['wr_10'] ?>" id="wr_10" required class="frm_input half_input required" placeholder="5 변수값">
        
            
        
        <label for="wr_11" class="sound_only">6변수이름<strong>필수</strong></label>
          <input type="text" name="wr_11" value="<?php echo $write['wr_11'] ?>" id="wr_11"  class="frm_input half_input" placeholder="6 변수이름">
 
        <label for="wr_12" class="sound_only">6변수값<strong>필수</strong></label>
          <input style="margin-left: 8px" type="text" name="wr_12" value="<?php echo $write['wr_12'] ?>" id="wr_12"  class="frm_input half_input " placeholder="6 변수값">
              
        
        
        <label for="wr_13" class="sound_only">7변수이름<strong>필수</strong></label>
          <input type="text" name="wr_13" value="<?php echo $write['wr_13'] ?>" id="wr_13"  class="frm_input half_input " placeholder="7 변수이름">
 
        <label for="wr_14" class="sound_only">7변수값<strong>필수</strong></label>
          <input style="margin-left: 8px" type="text" name="wr_14" value="<?php echo $write['wr_14'] ?>" id="wr_14"  class="frm_input half_input" placeholder="7 변수값">
              
      </div> 
<!--  insert graph end -->

 

감사합니다.^^

 

 

추천
9

댓글 전체

고맙습니다. 쪽지 방금 확인했습니다. 폼메일 잘 적용해서 심플한 테마에 적용해서 공개할까 합니다.
늘 좋은 소스를 공유해주서 항상 감사한 마음 가지고 있습니다^^
폼메일을 적극활용 하시려면 다음메일을 수신메일로 사용하세요.
네이버나 구글은 너무 제약이 많아서...
제 코드는 기본설정으로는 다음에는 바로 들어가고 나베르는 스팸으로  구글은 아예 튕겨냅니다.

폼메일은 홈페이지에서 일종의 액서사리이고 문의를 받는 게시판을 만드는 것이 정신건강에 이롭더라구요.
12월 9일 02시에 오타를 수정하고 여분필드 wr_18를 사용하여 통계단위를 나타내는 코드를 추가하였습니다.
전체 641 |RSS
그누보드5 스킨 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT