| | |
| | | }, |
| | | title: { |
| | | left: '5%', |
| | | text: '设备名称:' + this.otherData.deviceName + '\\单位:' + (this.otherData.unit ? this.otherData.unit : '') |
| | | text: '设备名称:' + this.otherData.deviceName |
| | | }, |
| | | toolbox: { |
| | | right: '5%', |
| | |
| | | type: 'value', |
| | | boundaryGap: [0, '100%'] |
| | | }, |
| | | dataZoom: [ |
| | | { |
| | | type: 'inside', |
| | | start: 0, |
| | | end: 10 |
| | | }, |
| | | { |
| | | start: 0, |
| | | end: 10 |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | formatter: (params) => { |
| | | var tips = '' |
| | | const value = params[0].value |
| | | if (value) { |
| | | tips = |
| | | '编号:' + |
| | | this.otherData.dataStream + |
| | | '<br />参数:' + |
| | | value + |
| | | '<br />备注:' + |
| | | (this.otherData.remark ? this.otherData.remark : '') + |
| | | '<br />单位:' + |
| | | (this.otherData.unit ? this.otherData.unit : '') + |
| | | '<br />时间:' + |
| | | params[0].axisValue |
| | | } |
| | | return tips |
| | | } |
| | | ], |
| | | }, |
| | | series: [ |
| | | { |
| | | name: '参数', |
| | | // name: '参数', |
| | | type: 'line', |
| | | label: { |
| | | normal: { |
| | | show: true, |
| | | position: 'top' |
| | | } |
| | | }, |
| | | symbol: 'none', |
| | | sampling: 'lttb', |
| | | itemStyle: { |
| | | color: 'rgb(255, 70, 131)' |
| | | }, |
| | | areaStyle: { |
| | | color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ |
| | | { |
| | | offset: 0, |
| | | color: 'rgb(255, 158, 68)' |
| | | }, |
| | | { |
| | | offset: 1, |
| | | color: 'rgb(255, 70, 131)' |
| | | } |
| | | ]) |
| | | }, |
| | | areaStyle: { normal: {} }, |
| | | data: this.seriesData |
| | | } |
| | | ] |
| | |
| | | }, |
| | | mounted() { |
| | | myChart = echarts.init(this.$refs.myChart) |
| | | option = this.makeOption() |
| | | this.initDrag() |
| | | }, |
| | | methods: { |
| | | makeOption() {}, |
| | | initDrag() { |
| | | myChart.setOption((option = this.option), true) |
| | | |
| | |
| | | window.addEventListener('resize', () => { |
| | | if (myChart) myChart.resize() |
| | | }) |
| | | }, |
| | | refreshData(seriesData, xAxisData) { |
| | | //刷新数据 |
| | | let refreshOption = myChart.getOption() |
| | | refreshOption.series[0].data = seriesData |
| | | refreshOption.xAxis[0].data = xAxisData |
| | | myChart.setOption(refreshOption) |
| | | } |
| | | }, |
| | | } |
| | | // watch: { |
| | | // yAxisMonth: { |
| | | // handler(newVal) { |
| | |
| | | // setTimeout(()=>{ |
| | | // myChart.setOption((option = this.option), true) |
| | | // },100) |
| | | |
| | | |
| | | // }, |
| | | // deep: true |
| | | // } |