echartsToolzm_20210421111131.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. import EC from 'echarts'
  2. import BASE from '@tools/base';
  3. const color = ["#00FFF0","#014EB5","#A800FF","#e82edb","#B5454C","#443bff","#e8cb25","#3dffb0","#e8a425","#ff7aab","#e84b1e","#552ce2","#ffae21","#e8861e","#d441ff","#35e8e4","#9c7aff","#e86fd8","#ffee38"];
  4. /*
  5. * 柱状图(非堆叠柱状图)
  6. * id: 元素ID
  7. * data 数据
  8. * [
  9. {
  10. name: "限电损失电量(单位:万kwh)",
  11. type: "bar",
  12. data: this.histogram.xdss,
  13. },
  14. {
  15. name: "故障损失电量(单位:万kwh)",
  16. type: "bar",
  17. data: this.histogram.gzss,
  18. },
  19. ,
  20. {
  21. name: "检修损失电量(单位:万kwh)",
  22. type: "bar",
  23. data: this.histogram.jxss,
  24. },
  25. {
  26. name: "性能损失电量(单位:万kwh)",
  27. type: "bar",
  28. data: this.histogram.xnss,
  29. },
  30. {
  31. name: "受累损失电量(单位:万kwh)",
  32. type: "bar",
  33. data: this.histogram.slss,
  34. },
  35. ]
  36. * xdata : 横坐标数据
  37. * */
  38. export function getBar_fdd(id, data , xdata) {
  39. if(data === undefined){
  40. message.error("没有找到报表数据,请检查!");
  41. return;
  42. }
  43. var myChart = EC.init(document.getElementById(id));
  44. var option = {
  45. title: {
  46. text: "损失电量分析",
  47. },
  48. tooltip: {
  49. trigger: "axis",
  50. axisPointer: {
  51. type: "shadow",
  52. },
  53. },
  54. legend: {
  55. data: [
  56. "限电损失电量(单位:万kwh)",
  57. "故障损失电量(单位:万kwh)",
  58. "检修损失电量(单位:万kwh)",
  59. "性能损失电量(单位:万kwh)",
  60. "受累损失电量(单位:万kwh)",
  61. ],
  62. },
  63. grid: {
  64. left: "3%",
  65. right: "4%",
  66. bottom: "3%",
  67. containLabel: true,
  68. },
  69. yAxis: {
  70. type: "value",
  71. boundaryGap: [0, 0.01],
  72. },
  73. xAxis: {
  74. type: "category",
  75. data: xdata,
  76. },
  77. series: data,
  78. };
  79. myChart.setOption(option, true);
  80. }
  81. /**
  82. *
  83. * @param {id名称} id
  84. * @param {第一台风机数据} value1
  85. * @param {第一台风机名字} name1
  86. * @param {第二台风机数据} value2
  87. * @param {第二台风机名字} name2
  88. * @returns
  89. */
  90. export function leida_tc(id , value1 , name1 , value2 , name2) {
  91. if(value1 === undefined || value2 === undefined){
  92. message.error("没有找到报表数据,请检查!");
  93. return;
  94. }
  95. var myChart = EC.init(document.getElementById(id));
  96. var option;
  97. option = {
  98. title: {
  99. text: "对标排名分析",
  100. left: 400,
  101. top: -5,
  102. textStyle: {
  103. fontSize: 13,
  104. },
  105. },
  106. grid: {
  107. top: "10%",
  108. left: "10%",
  109. right: "10%",
  110. bottom: "0",
  111. },
  112. tooltip: {},
  113. legend: {
  114. orient: "vertical",
  115. x: "left", //可设定图例在左、右、居中
  116. y: "0", //可设定图例在上、下、居中
  117. padding: [0, 50, 0, 0],
  118. },
  119. radar: {
  120. // shape: 'circle',
  121. name: {
  122. textStyle: {
  123. color: "#fff",
  124. backgroundColor: "#999",
  125. borderRadius: 3,
  126. padding: [3, 5],
  127. },
  128. },
  129. indicator: [
  130. { name: "风能利用率", max: 100 },
  131. { name: "故障损失率", max: 100 },
  132. { name: "检修损失率", max: 100 },
  133. { name: "弃风率", max: 100 },
  134. { name: "性能损失率", max: 100 },
  135. { name: "受累损失率", max: 100 },
  136. { name: "复位及时率", max: 100 },
  137. { name: "状态转换率", max: 100 },
  138. { name: "消缺及时率", max: 100 },
  139. ],
  140. },
  141. series: [
  142. {
  143. name: "预算 vs 开销(Budget vs spending)",
  144. type: "radar",
  145. // areaStyle: {normal: {}},
  146. data: [
  147. {
  148. value: value1,
  149. name: name1,
  150. },
  151. {
  152. value: value2,
  153. name: name2,
  154. },
  155. ],
  156. },
  157. ],
  158. };
  159. myChart.setOption(option, true);
  160. }
  161. /**
  162. *
  163. * @param {id名称} id
  164. * @param {第一台风机数据} value1
  165. * @param {第二台风机数据} value2
  166. * @returns
  167. */
  168. export function bar_tc(id , value1 , value2) {
  169. if(value1 === undefined || value2 === undefined){
  170. message.error("没有找到报表数据,请检查!");
  171. return;
  172. }
  173. var myChart = EC.init(document.getElementById(id));
  174. var option;
  175. option = {
  176. tooltip: {
  177. trigger: "axis",
  178. axisPointer: {
  179. type: "cross",
  180. crossStyle: {
  181. color: "#999",
  182. },
  183. },
  184. },
  185. title: {
  186. text: "损失电量分析",
  187. left: 100,
  188. top: 8,
  189. textStyle: {
  190. fontSize: 13,
  191. },
  192. },
  193. grid: {
  194. top: "90",
  195. left: "10%",
  196. right: "10%",
  197. bottom: "30",
  198. },
  199. legend: {
  200. orient: "vertical",
  201. x: "right", //可设定图例在左、右、居中
  202. y: 0, //可设定图例在上、下、居中
  203. padding: [0, 50, 200, 0],
  204. data: [
  205. "限电损失电量(单位:万kwh)",
  206. "故障损失电量(单位:万kwh)",
  207. "检修损失电量(单位:万kwh)",
  208. "性能损失电量(单位:万kwh)",
  209. "受累损失电量(单位:万kwh)",
  210. ],
  211. },
  212. xAxis: [
  213. {
  214. type: "category",
  215. data: [
  216. BASE.getBzDate(new Date(value1.recordDate),0),
  217. BASE.getBzDate(new Date(value2.recordDate),0),
  218. ],
  219. axisPointer: {
  220. type: "shadow",
  221. },
  222. },
  223. ],
  224. yAxis: [
  225. {
  226. type: "value",
  227. name: "电量",
  228. interval: 50,
  229. axisLabel: {
  230. formatter: "{value} 万kw",
  231. },
  232. },
  233. ],
  234. series: [
  235. {
  236. name: "限电损失电量(单位:万kwh)",
  237. type: "bar",
  238. yAxisIndex: 0,
  239. data: [value1.xdss, value2.xdss],
  240. },
  241. {
  242. name: "故障损失电量(单位:万kwh)",
  243. type: "bar",
  244. yAxisIndex: 0,
  245. data: [value1.zzss, value2.gzss],
  246. },
  247. {
  248. name: "检修损失电量(单位:万kwh)",
  249. type: "bar",
  250. yAxisIndex: 0,
  251. data: [value1.jxss, value2.jxss],
  252. },
  253. {
  254. name: "性能损失电量(单位:万kwh)",
  255. type: "bar",
  256. yAxisIndex: 0,
  257. data: [value1.xnss, value2.xnss],
  258. },
  259. {
  260. name: "受累损失电量(单位:万kwh)",
  261. type: "bar",
  262. yAxisIndex: 0,
  263. data: [value1.slss, value2.slss],
  264. },
  265. ],
  266. };
  267. myChart.setOption(option, true);
  268. }
  269. /**
  270. *
  271. * @param {id名称} id
  272. * @param {数据} value
  273. * @returns
  274. */
  275. export function bar_tc_2(id , value) {
  276. if(value === undefined){
  277. message.error("没有找到报表数据,请检查!");
  278. return;
  279. }
  280. var myChart = EC.init(document.getElementById(id));
  281. let option = {
  282. legend: {
  283. orient: "vertical",
  284. left: "right",
  285. },
  286. tooltip: {},
  287. dataset: {
  288. dimensions: [
  289. "product",
  290. "限电损失电量单位:万KWh",
  291. "故障损失电量单位:万KWh",
  292. "检修损失电量单位:万KWh",
  293. "性能损失电量单位:万KWh",
  294. "受累损失电量单位:万KWh",
  295. ],
  296. source: this.sortInOrde2,
  297. },
  298. xAxis: { type: "category" },
  299. yAxis: {},
  300. // Declare several bar series, each will be mapped
  301. // to a column of dataset.source by default.
  302. series: [
  303. {
  304. // barGap:'100%',/*多个并排柱子设置柱子之间的间距*/
  305. type: "bar",
  306. barWidth: 30,
  307. itemStyle: {
  308. normal: {
  309. color: "#D201D8",
  310. },
  311. },
  312. },
  313. {
  314. type: "bar",
  315. barWidth: 30,
  316. itemStyle: {
  317. normal: {
  318. color: "#FD0100",
  319. },
  320. },
  321. },
  322. {
  323. type: "bar",
  324. barWidth: 30,
  325. itemStyle: {
  326. normal: {
  327. color: "#FF7B16",
  328. },
  329. },
  330. },
  331. {
  332. type: "bar",
  333. barWidth: 30,
  334. itemStyle: {
  335. normal: {
  336. color: "#8085E9",
  337. },
  338. },
  339. },
  340. {
  341. type: "bar",
  342. barWidth: 30,
  343. itemStyle: {
  344. normal: {
  345. color: "#A6A6A6",
  346. },
  347. },
  348. },
  349. ],
  350. };
  351. myChart.setOption(option, true);
  352. }
  353. export default {
  354. getBar_fdd,
  355. leida_tc,
  356. bar_tc,
  357. bar_tc_2,
  358. color,
  359. }