You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.9 KiB

7 years ago
7 years ago
7 years ago
7 years ago
  1. <?=$this->site->add_js("https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js")?>
  2. <?=$this->site->add_js("https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js")?>
  3. <div class="page-header">
  4. <h1 class="page-title">방문 시간별 접속 통계</h1>
  5. </div>
  6. <?=form_open(NULL, array('method'=>'get','class'=>'form-flex','autocomplete'=>'off'))?>
  7. <div data-ax-tbl class="ax-search-tbl">
  8. <div data-ax-tr>
  9. <div data-ax-td>
  10. <div data-ax-td-label>일자 검색</div>
  11. <div data-ax-td-wrap>
  12. <input class="form-control" name="startdate" data-toggle="datepicker" data-chained-datepicker="[name='enddate']" value="<?=$startdate?>">
  13. </div>
  14. <div data-ax-td-wrap>
  15. <input class="form-control" name="enddate" data-toggle="datepicker" value="<?=$enddate?>">
  16. </div>
  17. </div>
  18. <div data-ax-td>
  19. <div data-ax-td-wrap>
  20. <button class="btn btn-sm btn-default"><i class="fal fa-search"></i> 필터적용</button>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. <?=form_close()?>
  26. <div class="H10"></div>
  27. <div class="row">
  28. <div class="col-sm-6">
  29. <div>
  30. <h4 class="text-center">방문 시간별 접속 통계</h4>
  31. <canvas id="chart-browser" width="200" height="200"></canvas>
  32. </div>
  33. </div>
  34. <div class="col-sm-6">
  35. <div class="grid">
  36. <table>
  37. <thead>
  38. <tr>
  39. <th>시간대</th>
  40. <th>접속수</th>
  41. <th>백분율(%)</th>
  42. </tr>
  43. </thead>
  44. <tbody>
  45. <?php foreach($statics['list'] as $key=>$value):?>
  46. <tr>
  47. <td class="text-center"><?=$key?>시</td>
  48. <td class="text-right"><?=number_format($value)?></td>
  49. <td class="text-right"><?=$statics['total']>0? round($value/$statics['total']*100,2):0?>%</td>
  50. </tr>
  51. <?php endforeach;?>
  52. <?php if(count($statics['list']) == 0):?>
  53. <tr>
  54. <td class="empty" colspan="3">키워드로 접속한 기록이 없습니다.</td>
  55. </tr>
  56. <?php endif;?>
  57. </tbody>
  58. <tfoot>
  59. <tr>
  60. <td class="text-center">TOTAL</td>
  61. <td class="text-right"><?=number_format($statics['total'])?></td>
  62. <td class="text-right">100%</td>
  63. </tr>
  64. </tfoot>
  65. </table>
  66. </div>
  67. </div>
  68. </div>
  69. <script>
  70. $(function(){
  71. var $chart = $("#chart-browser");
  72. var chart_data = <?=$statics['valuelist']?>;
  73. var chart = new Chart($chart, {
  74. type: 'line',
  75. data: {
  76. labels: <?=$statics['hourlist']?>,
  77. datasets: [{
  78. label : '방문자수',
  79. data: chart_data,
  80. backgroundColor : 'rgba(0,0,0,0.5)',
  81. borderColor : 'rgba(0,0,0,0.15)',
  82. borderWidth : '1px',
  83. pointBackgroundColor : '#cc7b19'
  84. }]
  85. },
  86. options : {
  87. animation : {
  88. animateScale:true
  89. },
  90. legend: {
  91. labels : {
  92. fontColor : '#fff'
  93. }
  94. },
  95. scales: {
  96. yAxes: [{
  97. ticks: {
  98. fontColor : '#fff'
  99. }
  100. }],
  101. xAxes: [{
  102. ticks: {
  103. fontColor : '#fff'
  104. }
  105. }],
  106. }
  107. }
  108. });
  109. });
  110. </script>