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.

103 lines
3.4 KiB

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. <?=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. <canvas id="chart-browser" width="200" height="200"></canvas>
  30. </div>
  31. <div class="col-sm-6">
  32. <div class="grid">
  33. <table>
  34. <thead>
  35. <tr>
  36. <th>키워드</th>
  37. <th class="W120">접속수</th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. <?php foreach($statics['list'] as $row):?>
  42. <tr>
  43. <td class="text-center"><?=$row['sta_keyword']?></td>
  44. <td class="text-right"><?=number_format($row['count'])?> (<?=$statics['total']>0? round($row['count']/$statics['total']*100,2):0?>%)</td>
  45. </tr>
  46. <?php endforeach;?>
  47. <?php if(count($statics['list']) == 0):?>
  48. <tr>
  49. <td class="empty" colspan="2">키워드로 접속한 기록이 없습니다.</td>
  50. </tr>
  51. <?php endif;?>
  52. </tbody>
  53. <tfoot>
  54. <tr>
  55. <td class="text-center">TOTAL</td>
  56. <td class="text-right"><?=number_format($statics['total'])?></td>
  57. </tr>
  58. </tfoot>
  59. </table>
  60. </div>
  61. </div>
  62. </div>
  63. <script>
  64. $(function(){
  65. var $chart = $("#chart-browser");
  66. var chart_data = <?=$statics['counts']?>;
  67. var chart = new Chart($chart, {
  68. type: 'pie',
  69. data: {
  70. labels: <?=$statics['sta_keyword']?>,
  71. datasets: [{
  72. label : '# %',
  73. data: chart_data,
  74. backgroundColor : randomColorGenerator(chart_data.length)
  75. }]
  76. },
  77. options : {
  78. animation : {
  79. animateScale:true
  80. },
  81. legend: {
  82. labels : {
  83. fontColor : '#282828'
  84. }
  85. }
  86. }
  87. });
  88. });
  89. var randomColorGenerator = function (count) {
  90. var ret = [];
  91. for(i=0; i<count;i++)
  92. {
  93. ret.push( '#' + (Math.random().toString(16) + '0000000').slice(2, 8) );
  94. }
  95. return ret;
  96. };
  97. </script>