wechatFollowersGrowth.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 param = {
  83. startMonth:startMonth,
  84. endMonth:endMonth
  85. };
  86. console.log(param);
  87. // 折线图
  88. $.ajax({
  89. url: "../monthly/queryMonthlyWechatFollowers",
  90. data: param,
  91. contentType:"application/x-www-form-urlencoded",
  92. type: 'POST',
  93. success: function(data) {
  94. console.log(data)
  95. weChatFun(data.dateList, data.wechatFollowersList);
  96. },
  97. });
  98. }
  99. function addWechatFollowers(){
  100. var wechatFollowers = document.getElementById("wechatFollowers").value;
  101. var param = {
  102. wechatFollowers:wechatFollowers
  103. };
  104. console.log(param);
  105. // 折线图
  106. $.ajax({
  107. url: "../monthly/addWechatFollowers",
  108. data: param,
  109. contentType:"application/x-www-form-urlencoded",
  110. type: 'POST',
  111. success: function(data) {
  112. alert(data.msg)
  113. },
  114. });
  115. }
  116. function exportMonthly(){
  117. var startMonth = document.getElementById("startMonth").value;
  118. var endMonth = document.getElementById("endMonth").value;
  119. var params = {
  120. startMonth:startMonth,
  121. endMonth:endMonth
  122. };
  123. console.log(params);
  124. exportFile('#rrapp', '../monthly/wechatFollowersGrowthExport', params);
  125. }