index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <div style="width: 100%;height: 100%">
  3. <div id="rpcharts"></div>
  4. </div>
  5. </template>
  6. <script>
  7. import resize from '../../../../components/Charts/mixins/resize'
  8. import echarts from 'echarts'
  9. import cc from '../../../../components/curvecolors'
  10. export default {
  11. mixins: [resize],
  12. watch: {
  13. drawData: {
  14. handler(newValue, oldValue) {
  15. console.log(newValue)
  16. this.draw(newValue.times, newValue.realValueDatas,newValue.ableValueDatas,newValue.theoryValueDatas,newValue.referencePowerByMeasuringDatas,newValue.referencePowerBySampleDatas,newValue.ablePowerByMeasuringDatas,newValue.ablePowerBySampleDatas,newValue.displayKyLl,newValue.cap)
  17. },
  18. deep: true
  19. },
  20. resizeKey: function (newQuestion, oldQuestion) {
  21. if (this.chart != null) {
  22. this.chart.resize();
  23. }
  24. }
  25. },
  26. props: {
  27. drawData: {
  28. type: Object,
  29. },
  30. resizeKey: {
  31. type: Number
  32. }
  33. },
  34. data() {
  35. return {
  36. chart: null,
  37. }
  38. },
  39. mounted() {
  40. },
  41. beforeDestroy() {
  42. if (!this.chart) {
  43. return
  44. }
  45. this.chart.dispose()
  46. this.chart = null
  47. },
  48. methods: {
  49. draw(timeaxis, realpower,ablepower,theorypower,referencePowerByMeasuringpower,referencePowerBySamplepower,ablePowerByMeasuringe,ablePowerBySample,displayKyLl,cap) {
  50. console.log(referencePowerByMeasuringpower)
  51. console.log(ablePowerByMeasuringe)
  52. this.chart = echarts.init(document.getElementById('rpcharts'))
  53. var option = {
  54. backgroundColor: 'transparent',
  55. title: {
  56. top: 20,
  57. text: '实际功率实时查询',
  58. textStyle: {
  59. fontWeight: 'normal',
  60. fontSize: 16,
  61. color: '#000000'
  62. },
  63. left: '1%'
  64. },
  65. tooltip: {
  66. trigger: 'axis',
  67. axisPointer: {
  68. lineStyle: {
  69. color: '#000000'
  70. }
  71. }
  72. },
  73. legend: {
  74. top: 20,
  75. icon: 'rect',
  76. itemWidth: 14,
  77. itemHeight: 5,
  78. itemGap: 13,
  79. data: ['实际功率'],
  80. right: '4%',
  81. textStyle: {
  82. fontSize: 12,
  83. color: '#000000'
  84. }
  85. },
  86. dataZoom: [{
  87. show: true,
  88. realtime: true,
  89. start: 0,
  90. end: 100,
  91. left: "15%",
  92. right: "15%",
  93. textStyle: {
  94. color: "#000000"
  95. }
  96. }, {
  97. type: 'inside'
  98. }],
  99. grid: {
  100. top: 100,
  101. left: '2%',
  102. right: '2%',
  103. bottom: '10%',
  104. containLabel: true
  105. },
  106. xAxis: [{
  107. type: 'category',
  108. boundaryGap: false,
  109. axisLine: {
  110. lineStyle: {
  111. color: "#000000"
  112. }
  113. },
  114. data: timeaxis
  115. }],
  116. yAxis: [{
  117. type: 'value',
  118. name: '(MW)',
  119. axisTick: {
  120. show: false
  121. },
  122. axisLine: {
  123. lineStyle: {
  124. color: '#000000'
  125. }
  126. },
  127. axisLabel: {
  128. margin: 10,
  129. textStyle: {
  130. fontSize: 14
  131. }
  132. },
  133. splitLine: {
  134. lineStyle: {
  135. color: '#57617B'
  136. }
  137. }
  138. }],
  139. series: [{
  140. name: '实际功率',
  141. type: 'line',
  142. smooth: false,
  143. symbol: 'circle',
  144. symbolSize: 5,
  145. showSymbol: false,
  146. lineStyle: {
  147. normal: {
  148. width: 2
  149. }
  150. },
  151. itemStyle: {
  152. normal: {
  153. color: cc.sj,
  154. borderColor: 'rgba(219,50,51,0.2)',
  155. borderWidth: 12
  156. }
  157. },
  158. data: realpower
  159. }]
  160. }
  161. option.yAxis[0].max = cap
  162. if(displayKyLl == 1){
  163. // option.legend.data = ['实际功率','可用功率','理论功率','参照理论功率(测风、测光法)','参照理论功率(样板机法)','参照可用功率(测风、测光法)','参照可用功率(样板机法)']
  164. option.legend.data = ['实际功率','可用功率','理论功率']
  165. option.series.push({
  166. name: '可用功率',
  167. type: 'line',
  168. smooth: true,
  169. symbol: 'circle',
  170. symbolSize: 5,
  171. showSymbol: false,
  172. lineStyle: {
  173. normal: {
  174. width: 2
  175. }
  176. },
  177. // areaStyle: {
  178. // normal: {
  179. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  180. // offset: 0,
  181. // color: 'rgba(219, 50, 51, 0.3)'
  182. // }, {
  183. // offset: 0.8,
  184. // color: 'rgba(219, 50, 51, 0)'
  185. // }], false),
  186. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  187. // shadowBlur: 10
  188. // }
  189. // },
  190. itemStyle: {
  191. normal: {
  192. color: cc.kygl,
  193. borderColor: 'rgba(219,50,51,0.2)',
  194. borderWidth: 12
  195. }
  196. },
  197. data: ablepower
  198. },{
  199. name: '理论功率',
  200. type: 'line',
  201. smooth: true,
  202. symbol: 'circle',
  203. symbolSize: 5,
  204. showSymbol: false,
  205. lineStyle: {
  206. normal: {
  207. width: 2
  208. }
  209. },
  210. // areaStyle: {
  211. // normal: {
  212. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  213. // offset: 0,
  214. // color: 'rgba(219, 50, 51, 0.3)'
  215. // }, {
  216. // offset: 0.8,
  217. // color: 'rgba(219, 50, 51, 0)'
  218. // }], false),
  219. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  220. // shadowBlur: 10
  221. // }
  222. // },
  223. itemStyle: {
  224. normal: {
  225. color: cc.llgl,
  226. borderColor: 'rgba(219,50,51,0.2)',
  227. borderWidth: 12
  228. }
  229. },
  230. data: theorypower
  231. }
  232. // {
  233. // name: '参照理论功率(测风、测光法)',
  234. // type: 'line',
  235. // smooth: true,
  236. // symbol: 'circle',
  237. // symbolSize: 5,
  238. // showSymbol: false,
  239. // lineStyle: {
  240. // normal: {
  241. // width: 2
  242. // }
  243. // },
  244. // areaStyle: {
  245. // normal: {
  246. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  247. // offset: 0,
  248. // color: 'rgba(219, 50, 51, 0.3)'
  249. // }, {
  250. // offset: 0.8,
  251. // color: 'rgba(219, 50, 51, 0)'
  252. // }], false),
  253. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  254. // shadowBlur: 10
  255. // }
  256. // },
  257. // itemStyle: {
  258. // normal: {
  259. //
  260. // color: cc.cfgf,
  261. // borderColor: 'rgba(219,50,51,0.2)',
  262. // borderWidth: 12
  263. // }
  264. // },
  265. // data: referencePowerByMeasuringpower
  266. // },{
  267. // name: '参照理论功率(样板机法)',
  268. // type: 'line',
  269. // smooth: true,
  270. // symbol: 'circle',
  271. // symbolSize: 5,
  272. // showSymbol: false,
  273. // lineStyle: {
  274. // normal: {
  275. // width: 2
  276. // }
  277. // },
  278. // areaStyle: {
  279. // normal: {
  280. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  281. // offset: 0,
  282. // color: 'rgba(219, 50, 51, 0.3)'
  283. // }, {
  284. // offset: 0.8,
  285. // color: 'rgba(219, 50, 51, 0)'
  286. // }], false),
  287. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  288. // shadowBlur: 10
  289. // }
  290. // },
  291. // itemStyle: {
  292. // normal: {
  293. //
  294. // color: cc.ybjf,
  295. // borderColor: 'rgba(219,50,51,0.2)',
  296. // borderWidth: 12
  297. // }
  298. // },
  299. // data: referencePowerBySamplepower
  300. // },{
  301. // name: '参照可用功率(测风、测光法)',
  302. // type: 'line',
  303. // smooth: true,
  304. // symbol: 'circle',
  305. // symbolSize: 5,
  306. // showSymbol: false,
  307. // lineStyle: {
  308. // normal: {
  309. // width: 2
  310. // }
  311. // },
  312. // areaStyle: {
  313. // normal: {
  314. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  315. // offset: 0,
  316. // color: 'rgba(219, 50, 51, 0.3)'
  317. // }, {
  318. // offset: 0.8,
  319. // color: 'rgba(219, 50, 51, 0)'
  320. // }], false),
  321. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  322. // shadowBlur: 10
  323. // }
  324. // },
  325. // itemStyle: {
  326. // normal: {
  327. // color: cc.kycfgf,
  328. // borderColor: 'rgba(219,50,51,0.2)',
  329. // borderWidth: 12
  330. // }
  331. // },
  332. // data: ablePowerByMeasuringe
  333. // },{
  334. // name: '参照可用功率(样板机法)',
  335. // type: 'line',
  336. // smooth: true,
  337. // symbol: 'circle',
  338. // symbolSize: 5,
  339. // showSymbol: false,
  340. // lineStyle: {
  341. // normal: {
  342. // width: 2
  343. // }
  344. // },
  345. // areaStyle: {
  346. // normal: {
  347. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  348. // offset: 0,
  349. // color: 'rgba(219, 50, 51, 0.3)'
  350. // }, {
  351. // offset: 0.8,
  352. // color: 'rgba(219, 50, 51, 0)'
  353. // }], false),
  354. // shadowColor: 'rgba(0, 0, 0, 0.1)',
  355. // shadowBlur: 10
  356. // }
  357. // },
  358. // itemStyle: {
  359. // normal: {
  360. // color: cc.kyybjf,
  361. // borderColor: 'rgba(219,50,51,0.2)',
  362. // borderWidth: 12
  363. // }
  364. // },
  365. // data: ablePowerBySample
  366. // }
  367. )
  368. }
  369. this.chart.setOption(option,true)
  370. },
  371. }
  372. }
  373. </script>
  374. <style scoped>
  375. #rpcharts {
  376. width: 100%;
  377. height: calc(80vh - 50px);
  378. }
  379. </style>