| | |
| | | public activeRoute: ActivatedRoute, |
| | | public msgSrv: NzMessageService |
| | | ) { |
| | | for (let index = 0; index < 19; index++) { |
| | | for (let index = 0; index < 30; index++) { |
| | | this.sensorArr.push(index); |
| | | } |
| | | } |
| | |
| | | }, |
| | | legend: { |
| | | data: [], |
| | | left: 'left' |
| | | orient: 'vertical', |
| | | right: 40, |
| | | top: 5, |
| | | bottom: 20 |
| | | }, |
| | | toolbox: { |
| | | show: false, |
| | |
| | | }; |
| | | |
| | | sensorArr: any = []; |
| | | arr = new Array(); |
| | | |
| | | |
| | | ngOnInit() { |
| | | this.activeRoute.queryParams.subscribe(params => { |
| | | const items = JSON.parse(params.items); |
| | |
| | | this.msgSrv.error(res.message); |
| | | } else { |
| | | const option = this.echartOption; |
| | | const data = res.data.data; |
| | | const time = res.data.time |
| | | let index = 0; |
| | | option.xAxis.data = time; |
| | | const datas = res.data.datas; |
| | | const times = res.data.times |
| | | const sensors = res.data.sensors |
| | | option.xAxis.data = times; |
| | | option.xAxis.name = query.xAxisName; |
| | | |
| | | for (const key in data[0].data0[0]) { |
| | | this.arr.push(index); |
| | | let split = key.split('-'); |
| | | for (let index = 0; index < sensors.length; index++) { |
| | | let sensorKey = sensors[index]; |
| | | let split = sensorKey.split('-'); |
| | | option.title.text = split[1] + query.label + '历走势图'; |
| | | option.yAxis.name = split[2]; |
| | | option.yAxis.name = split[2] && split[2] != 'null' ? split[2] : ''; |
| | | option.series = []; |
| | | option.legend.data = []; |
| | | |
| | | for (let i = 0; i < items.length; i++) { |
| | | const legendName = (items[i].mac ? items[i].mac : items[i].monitorPoint) + items[i].formatTime + query.label; |
| | | const legendName = items[i].formatTime + query.label + (items[i].mac ? items[i].deviceName : items[i].monitorPointName); |
| | | option.legend.data[i] = legendName; |
| | | const seriesData = data[i]['data' + i][0][key]; |
| | | const seriesData = datas[i]['data' + i][0][sensorKey]; |
| | | option.series.push({ |
| | | data: seriesData, |
| | | smooth: true, |
| | |
| | | const myChart = echarts.init(document.getElementById('mydiv' + index)); |
| | | myChart.setOption(option, true); |
| | | window.onresize = myChart.resize; |
| | | index++; |
| | | } |
| | | |
| | | this.sensorArr.forEach(i => { |
| | | if (this.arr.indexOf(i) == -1) { |
| | | if (i >= sensors.length) { |
| | | $('#mydiv' + i).remove(); |
| | | } |
| | | }); |