wechatFollowersGrowth.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. $(function () {
  2. });
  3. var myChart;
  4. // 基于准备好的dom,初始化echarts实例
  5. var dChart = echarts.init(document.getElementById('main4'));
  6. // 指定图表的配置项和数据
  7. function weChatFun(dateList, wechatFollowersList) {
  8. dChart.setOption({
  9. tooltip: {
  10. trigger: 'axis',
  11. axisPointer: {
  12. type: 'shadow',
  13. crossStyle: {
  14. color: '#999'
  15. }
  16. }
  17. },
  18. grid: {
  19. show: false,
  20. left: '3%',
  21. right: '4%',
  22. bottom: '10%'
  23. },
  24. xAxis: {
  25. // splitLine: {     show: false   },
  26. type: 'category',
  27. data: dateList,
  28. axisPointer: {
  29. type: 'shadow'
  30. },
  31. // 改变x轴颜色
  32. axisLine: {
  33. lineStyle: {
  34. color: '#00a2e2',
  35. width: 1, // 这里是为了突出显示加上的
  36. }
  37. },
  38. axisTick: {
  39. show: true,
  40. interval: 0
  41. },
  42. },
  43. // 设置两个y轴,左边显示数量,右边显示概率
  44. yAxis: {
  45. splitLine: {     show: false   },
  46. type: 'value',
  47. name: '好友数量',
  48. // max: 10000,
  49. // min: 0,
  50. // show: true,
  51. // interval: 1000,
  52. // 改变y轴颜色
  53. axisLine: {
  54. lineStyle: {
  55. color: '#00a2e2',
  56. width: 1, // 这里是为了突出显示加上的
  57. }
  58. },
  59. },
  60. // 每个设备分数量、概率2个指标,只要让他们的name一致,即可通过,legeng进行统一的切换
  61. series: [{
  62. //折线
  63. name: 'WechatFollowers',
  64. type: 'line',
  65. symbol: 'circle', // 折线点设置为实心点
  66. symbolSize: 6, // 折线点的大小
  67. yAxisIndex: 0, // 这里要设置哪个y轴,默认是最左边的是0,然后1,2顺序来。
  68. data: wechatFollowersList,
  69. symbolSize: 10,
  70. itemStyle: {
  71. normal: {
  72. color: "#DDA0DD"
  73. }
  74. }
  75. }
  76. ]
  77. });
  78. }
  79. function queryMonthly(){
  80. var startMonth = document.getElementById("startMonth").value;
  81. var endMonth = document.getElementById("endMonth").value;
  82. var startMonthDate = new Date(startMonth);
  83. var endMonthDate = new Date(endMonth);
  84. if(startMonthDate.getTime() > endMonthDate.getTime()){
  85. alert("开始时间不能大于结束时间");
  86. return;
  87. }
  88. var param = {
  89. startMonth:startMonth,
  90. endMonth:endMonth
  91. };
  92. console.log(param);
  93. // 折线图
  94. $.ajax({
  95. url: "../monthly/queryMonthlyWechatFollowers",
  96. data: param,
  97. contentType:"application/x-www-form-urlencoded",
  98. type: 'POST',
  99. success: function(data) {
  100. console.log(data)
  101. if (data.code =='500'){
  102. alert(data.msg);
  103. return;
  104. }
  105. weChatFun(data.dateList, data.wechatFollowersList);
  106. },
  107. });
  108. }
  109. function addWechatFollowers(){
  110. var wechatFollowers = document.getElementById("wechatFollowers").value;
  111. var param = {
  112. wechatFollowers:wechatFollowers
  113. };
  114. console.log(param);
  115. // 折线图
  116. $.ajax({
  117. url: "../monthly/addWechatFollowers",
  118. data: param,
  119. contentType:"application/x-www-form-urlencoded",
  120. type: 'POST',
  121. success: function(data) {
  122. alert(data.msg)
  123. },
  124. });
  125. }
  126. function exportMonthly(){
  127. var startMonth = document.getElementById("startMonth").value;
  128. var endMonth = document.getElementById("endMonth").value;
  129. var startMonthDate = new Date(startMonth);
  130. var endMonthDate = new Date(endMonth);
  131. if(startMonthDate.getTime() > endMonthDate.getTime()){
  132. alert("开始时间不能大于结束时间");
  133. return;
  134. }
  135. var params = {
  136. startMonth:startMonth,
  137. endMonth:endMonth
  138. };
  139. if (startMonth==null || startMonth==undefined || startMonth==''){
  140. alert("请输入开始时间");
  141. return;
  142. }
  143. if (endMonth==null || endMonth==undefined || endMonth==''){
  144. alert("请输入开始时间");
  145. return;
  146. }
  147. console.log(params);
  148. exportFile('#rrapp', '../monthly/wechatFollowersGrowthExport', params);
  149. }