widgetBarCompareChart.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. <!--
  2. * @Descripttion: 大屏报表设计器-动态组件
  3. * @Author: qianming
  4. * @Date: 2021-8-24 16:38:27
  5. * @LastEditors: qianming
  6. * @LastEditTime: 2023-11-21 17:38:44
  7. -->
  8. <template>
  9. <div :style="styleObj">
  10. <v-chart ref="myVChart" :options="options" autoresize/>
  11. </div>
  12. </template>
  13. <script>
  14. import {targetWidgetLinkageLogic} from "@/views/bigScreenDesigner/designer/linkageLogic";
  15. export default {
  16. name: "WidgetBarCompareChart",
  17. //参考 https://www.makeapie.com/editor.html?c=xrJwcCF3NZ
  18. components: {},
  19. props: {
  20. value: Object,
  21. ispreview: Boolean,
  22. },
  23. data() {
  24. return {
  25. options: {
  26. title: {
  27. //text: '柱状对比图',
  28. x: "center",
  29. textStyle: {
  30. color: "#ffffff",
  31. },
  32. },
  33. //边距
  34. grid: [
  35. {
  36. //左
  37. show: false, //边框线
  38. left: "4%",
  39. top: 60,
  40. bottom: 10,
  41. containLabel: true,
  42. width: "40%",
  43. },
  44. {
  45. //中间字体位置
  46. show: false,
  47. left: "50.5%",
  48. top: 60,
  49. bottom: 25,
  50. width: "0%",
  51. },
  52. {
  53. //右
  54. show: false,
  55. right: "4%",
  56. top: 60,
  57. bottom: 10,
  58. containLabel: true,
  59. width: "40%",
  60. },
  61. ],
  62. //图例
  63. legend: {
  64. textStyle: {
  65. color: "#fff",
  66. textAlign: "center",
  67. },
  68. //itemGap:80,
  69. //itemWidth: 0
  70. },
  71. xAxis: [
  72. {
  73. // 左
  74. splitNumber: 2,
  75. show: true,
  76. type: "value",
  77. inverse: true,
  78. axisLine: {
  79. //底分割线
  80. show: false,
  81. },
  82. axisTick: {
  83. show: false,
  84. },
  85. position: "bottom",
  86. axisLabel: {
  87. // x轴
  88. show: true,
  89. textStyle: {
  90. color: "#ffffff",
  91. fontSize: 12,
  92. },
  93. },
  94. splitLine: {
  95. // 竖分割线
  96. show: true,
  97. lineStyle: {
  98. color: "#57617f",
  99. width: 1,
  100. type: "solid",
  101. },
  102. },
  103. },
  104. {
  105. gridIndex: 1,
  106. show: false,
  107. },
  108. {
  109. // 右
  110. gridIndex: 2,
  111. show: true,
  112. type: "value",
  113. axisLine: {
  114. show: false,
  115. },
  116. axisTick: {
  117. show: false,
  118. },
  119. position: "bottom",
  120. axisLabel: {
  121. show: true,
  122. textStyle: {
  123. color: "#ffffff",
  124. fontSize: 12,
  125. },
  126. },
  127. splitLine: {
  128. show: true,
  129. lineStyle: {
  130. color: "#57617f",
  131. width: 1,
  132. type: "solid",
  133. },
  134. },
  135. },
  136. ],
  137. yAxis: [
  138. {
  139. type: "category",
  140. inverse: true,
  141. position: "right",
  142. axisLine: {
  143. show: false,
  144. },
  145. axisTick: {
  146. show: false,
  147. },
  148. axisLabel: {
  149. show: false,
  150. },
  151. data: [],
  152. },
  153. {
  154. //处理轴数据
  155. gridIndex: 1,
  156. type: "category",
  157. inverse: true,
  158. position: "left",
  159. axisLine: {
  160. show: false,
  161. },
  162. axisTick: {
  163. show: false,
  164. },
  165. axisLabel: {
  166. show: true,
  167. textStyle: {
  168. align: "center",
  169. color: "#ffffff",
  170. fontSize: 14,
  171. },
  172. },
  173. data: [],
  174. },
  175. {
  176. gridIndex: 2,
  177. type: "category",
  178. inverse: true,
  179. position: "left",
  180. axisLine: {
  181. show: false,
  182. },
  183. axisTick: {
  184. show: false,
  185. },
  186. axisLabel: {
  187. show: false,
  188. },
  189. },
  190. ],
  191. series: [
  192. {
  193. name: "",
  194. type: "bar",
  195. barGap: 20,
  196. barWidth: 15,
  197. label: {
  198. normal: {
  199. show: true,
  200. color: "red",
  201. position: "insideLeft",
  202. textStyle: {
  203. color: "#ffffff",
  204. },
  205. },
  206. emphasis: {
  207. show: false,
  208. },
  209. },
  210. itemStyle: {
  211. normal: {
  212. color: "#36c5e7",
  213. barBorderRadius: [8, 0, 0, 8],
  214. },
  215. emphasis: {
  216. show: false,
  217. },
  218. },
  219. data: [],
  220. },
  221. {
  222. name: "",
  223. type: "bar",
  224. barGap: 20,
  225. barWidth: 15,
  226. xAxisIndex: 2,
  227. yAxisIndex: 2,
  228. label: {
  229. normal: {
  230. show: true,
  231. color: "red",
  232. position: "insideRight",
  233. textStyle: {
  234. color: "#ffffff",
  235. },
  236. },
  237. },
  238. itemStyle: {
  239. normal: {
  240. color: "#e68b55",
  241. barBorderRadius: [0, 8, 8, 0],
  242. },
  243. emphasis: {
  244. show: false,
  245. },
  246. },
  247. data: [],
  248. },
  249. ],
  250. },
  251. optionsStyle: {},
  252. optionsData: {},
  253. optionsSetup: {},
  254. flagInter: null,
  255. };
  256. },
  257. computed: {
  258. styleObj() {
  259. return {
  260. position: this.ispreview ? "absolute" : "static",
  261. width: this.optionsStyle.width + "px",
  262. height: this.optionsStyle.height + "px",
  263. left: this.optionsStyle.left + "px",
  264. top: this.optionsStyle.top + "px",
  265. background: this.optionsSetup.background,
  266. };
  267. },
  268. allComponentLinkage() {
  269. return this.$store.state.designer.allComponentLinkage;
  270. },
  271. },
  272. watch: {
  273. value: {
  274. handler(val) {
  275. this.optionsStyle = val.position;
  276. this.optionsData = val.data;
  277. this.optionsCollapse = val.setup;
  278. this.optionsSetup = val.setup;
  279. this.editorOptions();
  280. },
  281. deep: true,
  282. },
  283. },
  284. mounted() {
  285. this.optionsStyle = this.value.position;
  286. this.optionsData = this.value.data;
  287. this.optionsCollapse = this.value.setup;
  288. this.optionsSetup = this.value.setup;
  289. this.editorOptions();
  290. targetWidgetLinkageLogic(this); // 联动-目标组件逻辑
  291. },
  292. methods: {
  293. // 修改图标options属性
  294. editorOptions() {
  295. this.setOptionsTitle();
  296. this.setOptionsXLeft();
  297. this.setOptionsXRight();
  298. this.setOptionsY();
  299. this.setOptionsTop();
  300. this.setOptionsTooltip();
  301. this.setOptionsGrid();
  302. this.setOptionsLegend();
  303. this.setOptionsColor();
  304. this.setOptionsData();
  305. },
  306. // 标题修改
  307. setOptionsTitle() {
  308. const optionsSetup = this.optionsSetup;
  309. const title = {
  310. text: optionsSetup.text,
  311. show: optionsSetup.isShowTitle,
  312. left: optionsSetup.titleLeft,
  313. top: optionsSetup.titleTop + "%",
  314. itemGap: optionsSetup.titleItemGap,
  315. textStyle: {
  316. color: optionsSetup.textColor,
  317. fontSize: optionsSetup.textFontSize,
  318. fontWeight: optionsSetup.textFontWeight,
  319. fontStyle: optionsSetup.textFontStyle,
  320. fontFamily: optionsSetup.textFontFamily,
  321. },
  322. subtext: optionsSetup.subtext,
  323. subtextStyle: {
  324. color: optionsSetup.subtextColor,
  325. fontWeight: optionsSetup.subtextFontWeight,
  326. fontSize: optionsSetup.subtextFontSize,
  327. fontStyle: optionsSetup.subtextFontStyle,
  328. fontFamily: optionsSetup.subtextFontFamily
  329. },
  330. };
  331. this.options.title = title;
  332. },
  333. // 左X轴设置
  334. setOptionsXLeft() {
  335. const optionsSetup = this.optionsSetup;
  336. const xAxisLeft = {
  337. max: optionsSetup.maxXLeft !== "" ? optionsSetup.maxXLeft : null,
  338. splitNumber: optionsSetup.splitNumberXLeft,
  339. type: "value",
  340. show: optionsSetup.isShowXLeft,
  341. inverse: true,
  342. position: "bottom",
  343. axisLabel: {
  344. // x轴
  345. show: optionsSetup.isShowAxisLabelXLeft,
  346. //interval: optionsSetup.textIntervalXLeft,
  347. textStyle: {
  348. color: optionsSetup.textColorXLeft,
  349. fontSize: optionsSetup.textFontSizeXLeft,
  350. fontWeight: optionsSetup.textFontWeightXLeft,
  351. fontStyle: optionsSetup.textFontStyleXLeft,
  352. fontFamily: optionsSetup.textFontFamilyXLeft,
  353. },
  354. },
  355. //X轴线
  356. axisLine: {
  357. show: optionsSetup.isShowAxisLineXLeft,
  358. lineStyle: {
  359. color: optionsSetup.lineColorXLeft,
  360. width: optionsSetup.lineWidthXLeft,
  361. },
  362. },
  363. // X轴刻度线
  364. axisTick: {
  365. show: optionsSetup.isShowAxisLineXLeft,
  366. lineStyle: {
  367. color: optionsSetup.lineColorXLeft,
  368. width: optionsSetup.lineWidthXLeft,
  369. },
  370. },
  371. splitLine: {
  372. // 分割线
  373. show: optionsSetup.isShowSplitLineXLeft,
  374. lineStyle: {
  375. color: optionsSetup.splitLineColorXLeft,
  376. width: optionsSetup.splitLineWidthXLeft,
  377. type: "solid",
  378. },
  379. },
  380. };
  381. this.options.xAxis[0] = xAxisLeft;
  382. },
  383. // 右X轴设置
  384. setOptionsXRight() {
  385. const optionsSetup = this.optionsSetup;
  386. const xAxisRight = {
  387. max: optionsSetup.maxXRight !== "" ? optionsSetup.maxXRight : null,
  388. gridIndex: 2,
  389. splitNumber: optionsSetup.splitNumberXRight,
  390. show: optionsSetup.isShowXRight,
  391. type: "value",
  392. position: "bottom",
  393. axisLabel: {
  394. // x轴
  395. show: optionsSetup.isShowAxisLabelXRight,
  396. textStyle: {
  397. color: optionsSetup.textColorXRight,
  398. fontSize: optionsSetup.textFontSizeXRight,
  399. fontWeight: optionsSetup.textFontWeightXRight,
  400. fontStyle: optionsSetup.textFontStyleXRight,
  401. fontFamily: optionsSetup.textFontFamilyXRight,
  402. },
  403. },
  404. axisLine: {
  405. //X轴线
  406. show: optionsSetup.isShowAxisLineXRight,
  407. lineStyle: {
  408. color: optionsSetup.lineColorXRight,
  409. width: optionsSetup.lineWidthXRight,
  410. },
  411. },
  412. axisTick: {
  413. show: optionsSetup.isShowAxisLineXRight,
  414. lineStyle: {
  415. color: optionsSetup.lineColorXRight,
  416. width: optionsSetup.lineWidthXRight,
  417. },
  418. },
  419. splitLine: {
  420. // 分割线
  421. show: optionsSetup.isShowSplitLineXRight,
  422. lineStyle: {
  423. color: optionsSetup.splitLineColorXRight,
  424. width: optionsSetup.splitLineWidthXRight,
  425. type: "solid",
  426. },
  427. },
  428. };
  429. this.options.xAxis[2] = xAxisRight;
  430. },
  431. // Y轴设置
  432. setOptionsY() {
  433. const optionsSetup = this.optionsSetup;
  434. const yAxis = {
  435. //处理轴数据
  436. gridIndex: 1,
  437. type: "category",
  438. inverse: true,
  439. show: true,
  440. axisLabel: {
  441. show: optionsSetup.isShowAxisLabelY,
  442. interval: optionsSetup.textIntervalY,
  443. textStyle: {
  444. align: "center",
  445. color: optionsSetup.textColorY,
  446. fontSize: optionsSetup.textFontSizeY,
  447. fontWeight: optionsSetup.textFontWeightY,
  448. fontStyle: optionsSetup.textFontStyleY,
  449. fontFamily: optionsSetup.textFontFamilyY,
  450. },
  451. },
  452. axisLine: {
  453. show: false,
  454. },
  455. axisTick: {
  456. show: false,
  457. },
  458. };
  459. this.options.yAxis[1] = yAxis;
  460. },
  461. // 数值设定、柱体设置
  462. setOptionsTop() {
  463. const optionsSetup = this.optionsSetup;
  464. const series = this.options.series;
  465. series[0].label = {
  466. normal: {
  467. show: optionsSetup.isShow,
  468. position: "insideLeft",
  469. textStyle: {
  470. fontSize: optionsSetup.fontSize,
  471. color: optionsSetup.dataColor,
  472. fontWeight: optionsSetup.fontWeight,
  473. },
  474. },
  475. emphasis: {
  476. show: false,
  477. },
  478. };
  479. series[1].label = {
  480. normal: {
  481. show: optionsSetup.isShow,
  482. color: "red",
  483. position: "insideRight",
  484. textStyle: {
  485. fontSize: optionsSetup.fontSize,
  486. color: optionsSetup.dataColor,
  487. fontWeight: optionsSetup.fontWeight,
  488. },
  489. },
  490. emphasis: {
  491. show: false,
  492. },
  493. };
  494. for (const key in series) {
  495. series[key].barWidth = optionsSetup.maxWidth;
  496. //柱体背景属性
  497. series[key].showBackground = optionsSetup.isShowBackground;
  498. series[key].backgroundStyle = {
  499. color: optionsSetup.backgroundStyleColor,
  500. borderColor: optionsSetup.backgroundStyleBorderColor,
  501. borderWidth: optionsSetup.backgroundStyleBorderWidth,
  502. borderType: optionsSetup.backgroundStyleBorderType,
  503. shadowBlur: optionsSetup.backgroundStyleShadowBlur,
  504. shadowColor: optionsSetup.backgroundStyleShadowColor,
  505. opacity: optionsSetup.backgroundStyleOpacity / 100,
  506. };
  507. }
  508. this.options.series = series;
  509. },
  510. // tooltip 提示语设置
  511. setOptionsTooltip() {
  512. const optionsSetup = this.optionsSetup;
  513. const tooltip = {
  514. show: optionsSetup.isShowTooltip,
  515. trigger: optionsSetup.tooltipTrigger,
  516. axisPointer: {
  517. type: optionsSetup.tooltipAxisPointerType,
  518. },
  519. textStyle: {
  520. color: optionsSetup.tooltipColor,
  521. fontSize: optionsSetup.tooltipFontSize,
  522. fontWeight: optionsSetup.tooltipFontWeight,
  523. fontStyle: optionsSetup.tooltipFontStyle,
  524. fontFamily: optionsSetup.tooltipFontFamily,
  525. },
  526. };
  527. this.options.tooltip = tooltip;
  528. },
  529. // 边距设置
  530. setOptionsGrid() {
  531. const optionsSetup = this.optionsSetup;
  532. const grid = [
  533. {
  534. //左
  535. show: optionsSetup.frameLineLeft,
  536. borderColor: optionsSetup.borderColorLeft,
  537. borderWidth: optionsSetup.borderWidthLeft,
  538. left: optionsSetup.marginLeftRight,
  539. top: optionsSetup.marginTop,
  540. bottom: optionsSetup.marginBottom,
  541. containLabel: true,
  542. width: "40%",
  543. },
  544. {
  545. //中间字体位置
  546. show: false,
  547. left: "51%",
  548. top: optionsSetup.marginTop,
  549. bottom: optionsSetup.marginBottom + 15,
  550. width: "0%",
  551. },
  552. {
  553. //右
  554. show: optionsSetup.frameLineRight,
  555. borderColor: optionsSetup.borderColorRight,
  556. borderWidth: optionsSetup.borderWidthRight,
  557. right: optionsSetup.marginLeftRight,
  558. top: optionsSetup.marginTop,
  559. bottom: optionsSetup.marginBottom,
  560. containLabel: true,
  561. width: "40%",
  562. },
  563. ];
  564. this.options.grid = grid;
  565. },
  566. // 图例操作
  567. setOptionsLegend() {
  568. const optionsSetup = this.optionsSetup;
  569. const legend = {
  570. show: optionsSetup.isShowLegend,
  571. left: optionsSetup.lateralPosition,
  572. //right: optionsSetup.lateralPosition,
  573. top: optionsSetup.longitudinalPosition,
  574. //bottom: optionsSetup.longitudinalPosition,
  575. orient: optionsSetup.layoutFront,
  576. textStyle: {
  577. color: optionsSetup.legendColor,
  578. fontSize: optionsSetup.legendFontSize,
  579. fontWeight: optionsSetup.legendFontWeight,
  580. fontStyle: optionsSetup.legendFontStyle,
  581. fontFamily: optionsSetup.legendFontFamily,
  582. },
  583. itemHeight: optionsSetup.legendHeight,
  584. itemWidth: optionsSetup.legendWidth,
  585. };
  586. this.options.legend = legend;
  587. },
  588. // 图例名称设置
  589. setOptionsLegendName(name) {
  590. const optionsSetup = this.optionsSetup;
  591. const series = this.options.series;
  592. const legendName = optionsSetup.legendName;
  593. // 图例没有手动写则显示原值,写了则显示新值
  594. if (null == legendName || legendName == "") {
  595. for (let i = 0; i < name.length; i++) {
  596. series[i].name = name[i];
  597. }
  598. this.options.legend["data"] = name;
  599. } else {
  600. const arr = legendName.split("|");
  601. for (let i = 0; i < arr.length; i++) {
  602. series[i].name = arr[i];
  603. }
  604. this.options.legend["data"] = arr;
  605. }
  606. },
  607. // 颜色修改、圆角修改
  608. setOptionsColor() {
  609. const optionsSetup = this.optionsSetup;
  610. const customColor = optionsSetup.customColor;
  611. if (!customColor) return;
  612. const itemStyleLeft = {
  613. normal: {
  614. color: customColor[0].color,
  615. barBorderRadius: [optionsSetup.radius, 0, 0, optionsSetup.radius],
  616. },
  617. emphasis: {
  618. show: false,
  619. },
  620. };
  621. const itemStyleRight = {
  622. normal: {
  623. color: customColor[1].color,
  624. barBorderRadius: [0, optionsSetup.radius, optionsSetup.radius, 0],
  625. },
  626. emphasis: {
  627. show: false,
  628. },
  629. };
  630. this.options.series[0].itemStyle = itemStyleLeft;
  631. this.options.series[1].itemStyle = itemStyleRight;
  632. },
  633. // 数据解析
  634. setOptionsData(e, paramsConfig) {
  635. const optionsSetup = this.optionsSetup;
  636. const optionsData = this.optionsData; // 数据类型 静态 or 动态
  637. // 联动接收者逻辑开始
  638. optionsData.dynamicData = optionsData.dynamicData || {}; // 兼容 dynamicData undefined
  639. const myDynamicData = optionsData.dynamicData;
  640. clearInterval(this.flagInter); // 不管咋,先干掉上一次的定时任务,避免多跑
  641. if (
  642. e &&
  643. optionsData.dataType !== "staticData" &&
  644. Object.keys(myDynamicData.contextData).length
  645. ) {
  646. const keyArr = Object.keys(myDynamicData.contextData);
  647. paramsConfig.forEach((conf) => {
  648. if (keyArr.includes(conf.targetKey)) {
  649. myDynamicData.contextData[conf.targetKey] = e[conf.originKey];
  650. }
  651. });
  652. }
  653. // 联动接收者逻辑结束
  654. optionsData.dataType == "staticData"
  655. ? this.staticDataFn(optionsData.staticData, optionsSetup)
  656. : this.dynamicDataFn(
  657. optionsData.dynamicData,
  658. optionsData.refreshTime,
  659. optionsSetup
  660. );
  661. },
  662. //去重
  663. setUnique(arr) {
  664. let newArr = [];
  665. arr.forEach((item) => {
  666. return newArr.includes(item) ? "" : newArr.push(item);
  667. });
  668. return newArr;
  669. },
  670. //静态数据
  671. staticDataFn(val) {
  672. //数据
  673. let xAxisList = [];
  674. let yAxisList = [];
  675. let arrayList = [];
  676. const legendName = [];
  677. for (const i in val) {
  678. xAxisList[i] = val[i].axis;
  679. yAxisList[i] = val[i].name;
  680. }
  681. xAxisList = this.setUnique(xAxisList);
  682. yAxisList = this.setUnique(yAxisList);
  683. for (const i in yAxisList) {
  684. const data = new Array(xAxisList.length).fill(0);
  685. for (const j in xAxisList) {
  686. for (const k in val) {
  687. if (val[k].name == yAxisList[i]) {
  688. if (val[k].axis == xAxisList[j]) {
  689. data[j] = val[k].data;
  690. }
  691. }
  692. }
  693. }
  694. arrayList.push({
  695. name: yAxisList[i],
  696. data: data,
  697. });
  698. legendName.push(yAxisList[i]);
  699. }
  700. this.options.series[0]["name"] = arrayList[0].name;
  701. this.options.series[0]["data"] = arrayList[0].data;
  702. this.options.series[1]["name"] = arrayList[1].name;
  703. this.options.series[1]["data"] = arrayList[1].data;
  704. this.options.yAxis[1]["data"] = xAxisList;
  705. this.options.legend["data"] = legendName;
  706. this.setOptionsLegendName(legendName);
  707. },
  708. // 动态数据
  709. dynamicDataFn(val, refreshTime, optionsSetup) {
  710. if (!val) return;
  711. if (this.ispreview) {
  712. this.getEchartData(val, optionsSetup);
  713. this.flagInter = setInterval(() => {
  714. this.getEchartData(val, optionsSetup);
  715. }, refreshTime);
  716. } else {
  717. this.getEchartData(val, optionsSetup);
  718. }
  719. },
  720. getEchartData(val, optionsSetup) {
  721. const data = this.queryEchartsData(val);
  722. data.then((res) => {
  723. this.renderingFn(optionsSetup, res);
  724. });
  725. },
  726. renderingFn(optionsSetup, val) {
  727. const legendName = [];
  728. this.options.yAxis[1]["data"] = val.xAxis;
  729. if (val.series[0].type == "bar") {
  730. this.options.series[0]["name"] = val.series[0].name;
  731. this.options.series[0]["data"] = val.series[0].data;
  732. this.options.series[1]["name"] = val.series[1].name;
  733. this.options.series[1]["data"] = val.series[1].data;
  734. legendName.push(val.series[0].name);
  735. legendName.push(val.series[1].name);
  736. }
  737. this.options.legend["data"] = legendName;
  738. this.setOptionsLegendName(legendName);
  739. },
  740. },
  741. };
  742. </script>
  743. <style scoped lang="scss">
  744. .echarts {
  745. width: 100%;
  746. height: 100%;
  747. overflow: hidden;
  748. }
  749. </style>