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.

119 lines
4.0 KiB

7 years ago
7 years ago
7 years ago
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. <div class="box">
  7. <div class="box-header">
  8. <h4 class="box-title">검색 필터</h4>
  9. </div>
  10. <?=form_open(NULL, array('method'=>'get','class'=>'form-flex','autocomplete'=>'off'))?>
  11. <div data-ax-tbl class="ax-search-tbl">
  12. <div data-ax-tr>
  13. <div data-ax-td>
  14. <div data-ax-td-label>일자 검색</div>
  15. <div data-ax-td-wrap>
  16. <input class="form-control form-control-sm" name="startdate" data-toggle="datepicker" value="<?=$startdate?>">
  17. </div>
  18. <div data-ax-td-wrap>
  19. <input class="form-control form-control-sm" name="enddate" data-toggle="datepicker" value="<?=$enddate?>">
  20. </div>
  21. </div>
  22. <div data-ax-td>
  23. <div data-ax-td-wrap>
  24. <button class="btn btn-sm btn-default"><i class="far fa-search"></i> 필터적용</button>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <?=form_close()?>
  30. </div>
  31. <div class="H10"></div>
  32. <div class="row">
  33. <div class="col-sm-6">
  34. <div class="box">
  35. <div class="box-header">
  36. <h4 class="box-title">키워드별 접속 통계</h4>
  37. </div>
  38. <canvas id="chart-browser" width="200" height="200"></canvas>
  39. </div>
  40. </div>
  41. <div class="col-sm-6">
  42. <div class="box">
  43. <div class="box-header">
  44. <h4 class="box-title">키워드</h4>
  45. </div>
  46. <div data-ax5grid>
  47. <table>
  48. <thead>
  49. <tr>
  50. <th>키워드</th>
  51. <th>접속수</th>
  52. </tr>
  53. </thead>
  54. <tbody>
  55. <?php foreach($statics['list'] as $row):?>
  56. <tr>
  57. <td class="text-center"><?=$row['sta_keyword']?></td>
  58. <td class="text-right"><?=number_format($row['count'])?> (<?=$statics['total']>0? round($row['count']/$statics['total']*100,2):0?>%)</td>
  59. </tr>
  60. <?php endforeach;?>
  61. <?php if(count($statics['list']) == 0):?>
  62. <tr>
  63. <td class="empty" colspan="2">키워드로 접속한 기록이 없습니다.</td>
  64. </tr>
  65. <?php endif;?>
  66. </tbody>
  67. <tfoot>
  68. <tr>
  69. <td class="text-center">TOTAL</td>
  70. <td class="text-right"><?=number_format($statics['total'])?></td>
  71. </tr>
  72. </tfoot>
  73. </table>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <script>
  79. $(function(){
  80. var $chart = $("#chart-browser");
  81. var chart_data = <?=$statics['counts']?>;
  82. var chart = new Chart($chart, {
  83. type: 'pie',
  84. data: {
  85. labels: <?=$statics['sta_keyword']?>,
  86. datasets: [{
  87. label : '# %',
  88. data: chart_data,
  89. backgroundColor : randomColorGenerator(chart_data.length)
  90. }]
  91. },
  92. options : {
  93. animation : {
  94. animateScale:true
  95. },
  96. legend: {
  97. labels : {
  98. fontColor : '#282828'
  99. }
  100. }
  101. }
  102. });
  103. });
  104. var randomColorGenerator = function (count) {
  105. var ret = [];
  106. for(i=0; i<count;i++)
  107. {
  108. ret.push( '#' + (Math.random().toString(16) + '0000000').slice(2, 8) );
  109. }
  110. return ret;
  111. };
  112. </script>