sjsq_2.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. $(document).ready(function () {
  2. let dom = document.getElementById("sjsq2");
  3. let myChart = echarts.init(dom);
  4. let app = {};
  5. let option;
  6. $.post(ctx + "fzjc/sjsqSbsZs",function (res){
  7. option = {
  8. tooltip: {
  9. trigger: 'item',
  10. },
  11. series: [
  12. {
  13. name: '事件诉求',
  14. type: 'pie',
  15. radius: ['60%', '70%'],
  16. selectedOffset: 0, //选中块的偏移量
  17. label: {
  18. show: true,
  19. position: 'center',
  20. textStyle: {
  21. color: '#fff'
  22. },
  23. formatter: '{d}%'
  24. },
  25. emphasis: {
  26. label: {
  27. show: true,
  28. fontSize: '15',
  29. fontWeight: 'bold',
  30. color: '83bff6'
  31. }
  32. },
  33. labelLine: {
  34. show: false
  35. },
  36. data: [
  37. {
  38. value: res[1].data,
  39. name: res[1].name,
  40. itemStyle: {
  41. color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{
  42. offset: 0,
  43. color: '#1270d9'
  44. }, {
  45. offset: 1,
  46. color: '#00ffeb'
  47. }]),
  48. },
  49. selected: true, //默认选中第一块
  50. label: {
  51. show: true, //默认显示第一块
  52. fontSize: '20',
  53. fontWeight: 'bold'
  54. }
  55. },
  56. {
  57. value: res[0].data,
  58. name: res[0].name,
  59. itemStyle: {
  60. color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{
  61. offset: 0,
  62. color: '#ff8404'
  63. }, {
  64. offset: 1,
  65. color: '#ffd904'
  66. }]),
  67. }
  68. },
  69. ]
  70. }
  71. ]
  72. };
  73. if (option && typeof option === 'object') {
  74. myChart.setOption(option);
  75. myChart.on("click",function (params) {
  76. let prefix = ctx ;
  77. let url;
  78. /**环状图参数:1上报,2签收,3办结,4总数**/
  79. switch (params.name) {
  80. case "上报数" : url = prefix + "fzjc/goSjsqPie/1"; break;
  81. case "总数" : url = prefix + "fzjc/goSjsqPie/4"; break;
  82. }
  83. let btn = ['<i class="fa fa-close"></i> 关闭'];
  84. let options = {
  85. title: '上报数/总数占比',
  86. width: "1000",
  87. height: "550",
  88. url: url,
  89. btn: btn,
  90. callBack: doSubmit
  91. };
  92. $.modal.openOptions(options);
  93. });
  94. function doSubmit(index, layero){
  95. layer.close(index);
  96. }
  97. }
  98. });
  99. });