maintenancePlan.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. $(function(){
  2. initPlanInput();
  3. });
  4. function initPlanInput1(){
  5. var dom = document.getElementById("planInput1");
  6. var myChart = echarts.init(document.getElementById('planInput1'));
  7. var colorList = {
  8. type: 'linear',
  9. x: 0,
  10. y: 0,
  11. x2: 0,
  12. y2: 1,
  13. colorStops: [{
  14. offset: 0,
  15. color: '#06DBF5' // 0% 处的颜色
  16. }, {
  17. offset: 1,
  18. color: '#00d386' // 100% 处的颜色
  19. }],
  20. globalCoord: false // 缺省为 false
  21. }
  22. option = {
  23. backgroundColor: '#fff',
  24. tooltip: {
  25. trigger: 'axis',
  26. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  27. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  28. }
  29. },
  30. grid: {
  31. left: '3%',
  32. right: '4%',
  33. bottom: '0%',
  34. containLabel: true
  35. },
  36. xAxis: {
  37. type: 'category',
  38. data: ['2012', '2013', '2014', '2015', '2016',
  39. '2017', '2018'
  40. ],
  41. // axisTick: {
  42. // alignWithLabel: true
  43. // }
  44. axisLine: {
  45. lineStyle: {
  46. color: 'black'
  47. }
  48. },
  49. axisLabel: {
  50. interval: 0,
  51. rotate: 40,
  52. textStyle: {
  53. fontFamily: 'Microsoft YaHei'
  54. }
  55. },
  56. },
  57. yAxis: {
  58. type: 'value',
  59. axisLine: {
  60. // show: false,
  61. lineStyle: {
  62. color: 'black'
  63. }
  64. },
  65. splitLine: {
  66. show: true,
  67. lineStyle: {
  68. color: 'rgba(255,255,255,0.3)'
  69. }
  70. },
  71. axisLabel: {
  72. }
  73. },
  74. series: [{
  75. name: '',
  76. type: 'bar',
  77. barWidth: '40%',
  78. itemStyle: {
  79. color: function(params) {
  80. return colorList;
  81. },
  82. //barBorderRadius: 15,
  83. },
  84. emphasis:{
  85. itemStyle:{
  86. color:'#FBB419'
  87. }
  88. },
  89. data: [100, 120, 150, 140, 170, 160, 180]
  90. }]
  91. };
  92. if (option && typeof option === "object") {
  93. myChart.setOption(option, true);
  94. }
  95. }
  96. function initPlanInput(){
  97. var dom = document.getElementById("planInput");
  98. var myChart = echarts.init(document.getElementById('planInput'));
  99. var data = [2220, 1682, 2791, 3000, 4090, 3230, 2910];
  100. var xdata = ['2012', '2013', '2014', '2015', '2016', '2017', '2018'];
  101. var option = {
  102. grid: {
  103. left: 30,
  104. right: 50,
  105. top: 50,
  106. bottom: 30,
  107. containLabel: true
  108. },
  109. xAxis: {
  110. type: 'category',
  111. // boundaryGap: false,
  112. data: xdata,
  113. triggerEvent: true,
  114. splitLine: {
  115. show: false
  116. },
  117. axisLine: {
  118. show: true,
  119. lineStyle: {
  120. width: 2,
  121. color: 'rgba(255,255,255,.6)'
  122. }
  123. },
  124. axisTick: {
  125. show: false
  126. },
  127. axisLabel: {
  128. color: '#000',
  129. fontSize: 16,
  130. fontWeight: 'bold',
  131. /*textShadowColor: '#000',
  132. textShadowOffsetY: 2*/
  133. }
  134. },
  135. yAxis: {
  136. name: '单位(万元)',
  137. nameTextStyle: {
  138. color: '#000',
  139. fontSize: 16,
  140. /*textShadowColor: '#000',
  141. textShadowOffsetY: 2*/
  142. },
  143. type: 'value',
  144. splitLine: {
  145. show: true,
  146. lineStyle: {
  147. color: 'rgba(255,255,255,.2)'
  148. }
  149. },
  150. axisLine: {
  151. show: true,
  152. lineStyle: {
  153. width: 2,
  154. color: 'rgba(255,255,255,.6)'
  155. }
  156. },
  157. axisTick: {
  158. show: true
  159. },
  160. axisLabel: {
  161. color: '#000',
  162. fontSize: 16,
  163. /*textShadowColor: '#000',
  164. textShadowOffsetY: 2*/
  165. }
  166. },
  167. series: [{
  168. data: data,
  169. type: 'line',
  170. symbol: 'circle',
  171. symbolSize: 12,
  172. color: '#FEC201',
  173. lineStyle: {
  174. color: "#03E0F2"
  175. },
  176. label: {
  177. show: true,
  178. position: 'top',
  179. textStyle: {
  180. color: '#FEC201',
  181. fontSize: 18,
  182. fontWeight: 'bold'
  183. }
  184. },
  185. areaStyle: {
  186. color: 'rgba(1,98,133,0.6)'
  187. }
  188. }, {
  189. type: 'bar',
  190. animation: false,
  191. barWidth: 3,
  192. hoverAnimation: false,
  193. data: data,
  194. tooltip: {
  195. show: false
  196. },
  197. itemStyle: {
  198. normal: {
  199. color: {
  200. type: 'linear',
  201. x: 0,
  202. y: 0,
  203. x2: 0,
  204. y2: 1,
  205. colorStops: [{
  206. offset: 0,
  207. color: '#91EAF2' // 0% 处的颜色
  208. }, {
  209. offset: 1,
  210. color: '#074863' // 100% 处的颜色
  211. }],
  212. globalCoord: false // 缺省为 false
  213. },
  214. label: {
  215. show: false
  216. }
  217. }
  218. }
  219. }]
  220. }
  221. if (option && typeof option === "object") {
  222. myChart.setOption(option, true);
  223. }
  224. }