人人商城

stat-trend.html 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {template 'common/header'}
  2. <ul class="nav nav-tabs">
  3. <li class="active"><a href="javascript:;">关键指标详解</a></li>
  4. </ul>
  5. <div class="clearfix" id="clear">
  6. <div class="pull-left">
  7. <form action="" id="form1">
  8. <input type="hidden" name="c" value="platform">
  9. <input type="hidden" name="a" value="stat">
  10. <input type="hidden" name="do" value="trend">
  11. <input type="hidden" name="id" value={$id}>
  12. <input type="hidden" name="m" value={$_GPC['m']}>
  13. {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d', $starttime),'endtime'=>date('Y-m-d', $endtime)));}
  14. </form>
  15. </div>
  16. <div class="clearfix"></div>
  17. <br>
  18. <div class="panel panel-default" style="padding:1em">
  19. <nav role="navigation" class="navbar navbar-default navbar-static-top" style="margin: -1em -1em 1em -1em;">
  20. <div class="container-fluid">
  21. <div class="navbar-header">
  22. <a href="javascript:;" class="navbar-brand">规则使用趋势图</a>
  23. </div>
  24. </div>
  25. </nav>
  26. <div style="margin-top:20px;">
  27. <canvas id="myChart" height="80"></canvas>
  28. </div>
  29. </div>
  30. {loop $keywords $id $row}
  31. <div class="panel panel-default" style="padding:1em">
  32. <nav role="navigation" class="navbar navbar-default navbar-static-top" style="margin: -1em -1em 1em -1em;">
  33. <div class="container-fluid">
  34. <div class="navbar-header">
  35. <a href="javascript:;" class="navbar-brand">所属关键字使用趋势图&nbsp;&nbsp;&nbsp;<small>(关键字:{$keywordnames[$id]['content']})</small></a>
  36. </div>
  37. </div>
  38. </nav>
  39. <div style="margin-top:20px">
  40. <canvas id="trend_keyword_{$id}" height="80"></canvas>
  41. </div>
  42. </div>
  43. {/loop}
  44. </div>
  45. <script>
  46. require(['chart', 'daterangepicker'], function(c){
  47. $('.daterange').on('apply.daterangepicker', function(ev, picker) {
  48. $('#form1')[0].submit();
  49. });
  50. var label = {php echo json_encode($day)};
  51. var datasets = {php echo json_encode($hit)};
  52. var lineChartData = {
  53. labels : label,
  54. datasets : [
  55. {
  56. fillColor : "rgba(36,165,222,0.1)",
  57. strokeColor : "rgba(36,165,222,1)",
  58. pointColor : "rgba(36,165,222,1)",
  59. pointStrokeColor : "#fff",
  60. pointHighlightFill : "#fff",
  61. pointHighlightStroke : "rgba(36,165,222,1)",
  62. data : datasets
  63. }
  64. ]
  65. }
  66. var myLine = new Chart(document.getElementById("myChart").getContext("2d")).Line(lineChartData, {responsive : true});
  67. {loop $keywords $id $row}
  68. var label = {php echo json_encode($row['day'])};
  69. var datasets = {php echo json_encode($row['hit'])};
  70. var lineChartData = {
  71. labels : label,
  72. datasets : [
  73. {
  74. fillColor : "rgba(149,192,0,0.1)",
  75. strokeColor : "rgba(149,192,0,1)",
  76. pointColor : "rgba(149,192,0,1)",
  77. pointStrokeColor : "#fff",
  78. pointHighlightFill : "#fff",
  79. pointHighlightStroke : "rgba(149,192,0,1)",
  80. data : datasets
  81. }
  82. ]
  83. }
  84. var myLine = new Chart(document.getElementById("trend_keyword_{$id}").getContext("2d")).Line(lineChartData, {responsive : true});
  85. {/loop}
  86. });
  87. </script>
  88. {template 'common/footer'}