ÎļþÃû´Ó src/components/monitor/LineChart.vue ÐÞ¸Ä |
| | |
| | | import { factorName } from '@/constant/factor-name'; |
| | | import { factorLineOption } from '@/utils/chart/chart-option'; |
| | | |
| | | // 另坿å¨è¿åº¦æ¡çæçº¿å¾ |
| | | export default { |
| | | props: { |
| | | loading: Boolean, |
| | |
| | | // ä¿®æ¹å¾è¡¨å±ç¤ºçæçº¿å¾ç±»å |
| | | changeChartSeries() { |
| | | this.option.series = this.getShowSeries(); |
| | | this.option.legend.data = this.getLegends(this.option.series); |
| | | this.lineChart.setOption(this.option, { notMerge: true }); |
| | | }, |
| | | changeChartRange() { |
| | | const { sIndex, eIndex, startPer, endPer } = this.getRange(); |
| | | const showSeries = this.getShowSeries(sIndex, eIndex); |
| | | const xAxis = this.getShowXAxis(sIndex, eIndex); |
| | | const legends = this.getLegends(showSeries); |
| | | if (!this.option) { |
| | | this.option = factorLineOption(xAxis, showSeries, legends); |
| | | this.option = factorLineOption(xAxis, showSeries); |
| | | } else { |
| | | this.option.xAxis.data = xAxis; |
| | | this.option.series = showSeries; |
| | | this.option.legend.data = legends; |
| | | } |
| | | // this.option.dataZoom[0].start = startPer; |
| | | // this.option.dataZoom[0].end = endPer; |
| | |
| | | const startPer = (sIndex / this.allXAxis.length) * 100; |
| | | const endPer = (eIndex / this.allXAxis.length) * 100; |
| | | return { sIndex, eIndex, startPer, endPer }; |
| | | }, |
| | | getLegends(series) { |
| | | return series.map((s) => { |
| | | return s.name; |
| | | }); |
| | | } |
| | | }, |
| | | beforeUnmount() { |