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.

102 lines
3.3 KiB

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">OS별 접속 통계</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 style="max-width:400px;margin:auto">
  30. <h4 class="text-center">OS별 접속 통계</h4>
  31. <canvas id="chart-os" 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>OS</th>
  40. <th>접속수</th>
  41. </tr>
  42. </thead>
  43. <tbody>
  44. <?php foreach($statics['list'] as $row):?>
  45. <tr>
  46. <td class="text-center"><?=$row['sta_platform']?></td>
  47. <td class="text-right"><?=number_format($row['count'])?> (<?=$statics['total']>0? round($row['count']/$statics['total']*100,2):0?>%)</td>
  48. </tr>
  49. <?php endforeach;?>
  50. </tbody>
  51. <tfoot>
  52. <tr>
  53. <td class="text-center">TOTAL</td>
  54. <td class="text-right"><?=number_format($statics['total'])?></td>
  55. </tr>
  56. </tfoot>
  57. </table>
  58. </div>
  59. </div>
  60. </div>
  61. <script>
  62. $(function(){
  63. var $chart = $("#chart-os");
  64. var chart_data = <?=$statics['counts']?>;
  65. var chart = new Chart($chart, {
  66. type: 'pie',
  67. data: {
  68. labels: <?=$statics['sta_platform']?>,
  69. datasets: [{
  70. label : '# %',
  71. data: chart_data,
  72. backgroundColor : randomColorGenerator(chart_data.length)
  73. }]
  74. },
  75. options : {
  76. animation : {
  77. animateScale:true
  78. },
  79. legend: {
  80. labels : {
  81. fontColor : '#fff'
  82. }
  83. }
  84. }
  85. });
  86. });
  87. var randomColorGenerator = function (count) {
  88. var ret = [];
  89. for(i=0; i<count;i++)
  90. {
  91. ret.push( '#' + (Math.random().toString(16) + '0000000').slice(2, 8) );
  92. }
  93. return ret;
  94. };
  95. </script>