25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

123 lines
3.8 KiB

  1. $(function () {
  2. "use strict";
  3. // 基于准备好的dom,初始化echarts实例
  4. var pieChart = echarts.init(document.getElementById('piecontainer'));
  5. // 指定图表的配置项和数据
  6. var pieoption = {
  7. tooltip: {
  8. trigger: 'item',
  9. formatter: "{a} <br/>{b} : {c} ({d}%)"
  10. },
  11. legend: {
  12. bottom: 'bottom',
  13. data: ['枢纽楼', 'IDC中心', '端局', '模块局', '营业厅','办公大楼','C网基站']
  14. },
  15. series: [
  16. {
  17. name: '用电占比',
  18. type: 'pie',
  19. radius: '75%',
  20. center: ['50%', '50%'],
  21. label : {
  22. normal : {
  23. formatter: '{b}:{c}: ({d}%)',
  24. textStyle : {
  25. fontWeight : 'normal',
  26. fontSize : 12,
  27. color:'#333'
  28. }
  29. }
  30. },
  31. data: [
  32. { value: 10, name: '枢纽楼' },
  33. { value: 10, name: 'IDC中心' },
  34. { value: 10, name: '端局' },
  35. { value: 10, name: '模块局' },
  36. { value: 10, name: '营业厅' },
  37. { value: 10, name: '办公大楼' },
  38. { value: 40, name: 'C网基站' }
  39. ],
  40. itemStyle: {
  41. emphasis: {
  42. shadowBlur: 10,
  43. shadowOffsetX: 0,
  44. shadowColor: 'rgba(0, 0, 0, 0.5)'
  45. }
  46. }
  47. }
  48. ]
  49. ,
  50. color:['#df4d4b','#304552','#52bbc8','rgb(224,134,105)','#8dd5b4','#5eb57d','#d78d2f']
  51. };
  52. // 使用刚指定的配置项和数据显示图表。
  53. pieChart.setOption(pieoption);
  54. // 基于准备好的dom,初始化echarts实例
  55. var lineChart = echarts.init(document.getElementById('linecontainer'));
  56. // 指定图表的配置项和数据
  57. var lineoption = {
  58. tooltip: {
  59. trigger: 'axis'
  60. },
  61. legend: {
  62. bottom: 'bottom',
  63. data: ['预算', '实际']
  64. },
  65. grid: {
  66. bottom: '8%',
  67. containLabel: true
  68. },
  69. xAxis: {
  70. type: 'category',
  71. boundaryGap: false,
  72. data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
  73. },
  74. yAxis: {
  75. type: 'value'
  76. },
  77. series: [
  78. {
  79. name: '预算',
  80. type: 'line',
  81. stack: '用电量',
  82. itemStyle: {
  83. normal: {
  84. color: "#fc0d1b",
  85. lineStyle: {
  86. color: "#fc0d1b"
  87. }
  88. }
  89. },
  90. data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 23.3, 18.3, 13.9, 9.6, 1]
  91. },
  92. {
  93. name: '实际',
  94. type: 'line',
  95. stack: '用电量',
  96. itemStyle: {
  97. normal:{
  98. color:'#344858',
  99. lineStyle:{
  100. color:'#344858'
  101. }
  102. }
  103. },
  104. data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
  105. }
  106. ]
  107. };
  108. // 使用刚指定的配置项和数据显示图表。
  109. lineChart.setOption(lineoption);
  110. window.onresize = function (e) {
  111. pieChart.resize(e);
  112. lineChart.resize(e);
  113. }
  114. $(".lr-desktop-panel").mCustomScrollbar({ // 优化滚动条
  115. theme: "minimal-dark"
  116. });
  117. });