sjsq_8.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. $(document).ready(function () {
  2. let dom = document.getElementById("sjsq8");
  3. let myChart = echarts.init(dom);
  4. let app = {};
  5. let option;
  6. $.post(ctx + "fzjc/sjsqJdbj",function (res){
  7. option = {
  8. tooltip: {
  9. trigger: 'axis'
  10. },
  11. legend: {
  12. data: ['季度办结数'],
  13. textStyle: {
  14. color: '#00cdef'
  15. }
  16. },
  17. grid: {
  18. top: '15%',
  19. left: '5%',
  20. right: '5%',
  21. bottom: '5%',
  22. containLabel: true
  23. },
  24. xAxis: {
  25. type: 'category',
  26. boundaryGap: false,
  27. data: res.names,
  28. axisLabel: {
  29. interval: 0,
  30. formatter:function(value)
  31. {
  32. let ret = "";//拼接加\n返回的类目项
  33. let maxLength = 2;//每项显示文字个数
  34. let valLength = value.length;//X轴类目项的文字个数
  35. let rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
  36. if (rowN > 1)//如果类目项的文字大于3,
  37. {
  38. for (let i = 0; i < rowN; i++) {
  39. let temp = "";//每次截取的字符串
  40. let start = i * maxLength;//开始截取的位置
  41. let end = start + maxLength;//结束截取的位置
  42. //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
  43. temp = value.substring(start, end) + "\n";
  44. ret += temp; //凭借最终的字符串
  45. }
  46. return ret;
  47. }
  48. else {
  49. return value;
  50. }
  51. },
  52. color: '#00cdef'
  53. },
  54. axisLine: {
  55. show: true,
  56. lineStyle: {
  57. color: '#00cdef'
  58. }
  59. },
  60. splitLine: {
  61. show: false
  62. }
  63. },
  64. yAxis: {
  65. type: 'value',
  66. axisLabel: {
  67. show: true,
  68. color: '#00cdef'
  69. },
  70. axisLine: {
  71. show: true,
  72. lineStyle: {
  73. color: '#00cdef'
  74. }
  75. },
  76. splitLine: {
  77. show: true,
  78. lineStyle: {
  79. color: '#0b3747'
  80. }
  81. },
  82. },
  83. series: [
  84. {
  85. name: '季度办结数',
  86. type: 'line',
  87. stack: 'Total',
  88. smooth: true,
  89. data: res.datas,
  90. areaStyle: {
  91. opacity: 0.8,
  92. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  93. {
  94. offset: 0,
  95. color: 'rgb(55, 162, 255)'
  96. },
  97. {
  98. offset: 1,
  99. color: 'rgb(116, 21, 219)'
  100. }
  101. ])
  102. },
  103. }
  104. ]
  105. };
  106. if (option && typeof option === 'object') {
  107. myChart.setOption(option);
  108. myChart.on("click",function (params) {
  109. let prefix = ctx ;
  110. let url;
  111. /**环状图参数:1上报,2办结**/
  112. switch (params.name) {
  113. case "第一季度" : url = prefix + "fzjc/goSjsqLine/1/2"; break;
  114. case "第二季度" : url = prefix + "fzjc/goSjsqLine/2/2"; break;
  115. case "第三季度" : url = prefix + "fzjc/goSjsqLine/3/2"; break;
  116. case "第四季度" : url = prefix + "fzjc/goSjsqLine/4/2"; break;
  117. }
  118. let btn = ['<i class="fa fa-close"></i> 关闭'];
  119. let options = {
  120. title: '季度办结统计',
  121. width: "1000",
  122. height: "550",
  123. url: url,
  124. btn: btn,
  125. callBack: doSubmit
  126. };
  127. $.modal.openOptions(options);
  128. });
  129. }
  130. function doSubmit(index, layero){
  131. layer.close(index);
  132. }
  133. });
  134. })