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.

104 lines
3.6 KiB

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