| | |
| | | <ng-template #nzTitle> |
| | | 同期对比 |
| | | <small class="text-sm font-weight-normal"></small> |
| | | <span class="text-md font-weight-normal" style="color:red">PM2.5</span> |
| | | </ng-template> |
| | | <timeline [data]="offlineChartData" [height]="239" [padding]="[0, 0, 0, 0]" [titleMap]="{ y1: '本月数据', y2: '上月同期' }"></timeline> |
| | | <div id="PM25" style="height: 300px; width: 100%"></div> |
| | | <!-- <timeline [data]="offlineChartData" [height]="239" [padding]="[0, 0, 0, 0]" [titleMap]="{ y1: '本月数据', y2: '上月同期' }"></timeline> --> |
| | | </nz-card> |
| | | </div> |
| | | </div> |
| | |
| | | import { Component, OnInit, OnDestroy } from '@angular/core'; |
| | | import { environment } from '../../../../environments/environment'; |
| | | import { Component, OnInit, OnDestroy, AfterViewInit } from '@angular/core'; |
| | | import { NzMessageService } from 'ng-zorro-antd'; |
| | | import { _HttpClient } from '@delon/theme'; |
| | | import { HttpClient } from '@angular/common/http'; |
| | | import * as moment from 'moment'; |
| | | import { DeviceService } from '@business/services/http/device.service'; |
| | | import * as echarts from 'echarts'; |
| | | |
| | | @Component({ |
| | | selector: 'environment-management', |
| | |
| | | public msg: NzMessageService, |
| | | private http2: HttpClient) { |
| | | } |
| | | |
| | | |
| | | public option = { |
| | | tooltip: { |
| | | trigger: 'item', |
| | | axisPointer: { |
| | | type: 'cross' |
| | | } |
| | | }, |
| | | legend: { |
| | | right: '10%', |
| | | top: '10%', |
| | | data: ['本月数据', '上月同期'] |
| | | }, |
| | | xAxis: { |
| | | type: 'category', |
| | | data: [] |
| | | }, |
| | | yAxis: { |
| | | type: 'value', |
| | | name: '单位:ug/m³' |
| | | }, |
| | | series: [ |
| | | { |
| | | data: [], |
| | | type: 'line', |
| | | smooth: true, |
| | | name: '本月数据' |
| | | }, { |
| | | data: [], |
| | | type: 'line', |
| | | smooth: true, |
| | | name: '上月同期' |
| | | } |
| | | ] |
| | | }; |
| | | |
| | | ngAfterViewInit() { |
| | | const PM25 = echarts.init(document.getElementById('PM25')); |
| | | PM25.showLoading(); |
| | | const params = {
|
| | | type: 'month', |
| | | sensors: JSON.stringify(['e1']), |
| | | items: JSON.stringify([ |
| | | {areaCode: 320583, formatTime: moment().format('YYYY-MM')}, |
| | | {areaCode: 320583, formatTime: moment().subtract(1, 'M').format('YYYY-MM')} |
| | | ])
|
| | | }; |
| | | this.http2.get(environment.SERVER_BASH_URL + 'report/compare', {params: params}).subscribe((res: any) => { |
| | | this.option.xAxis.data = res.data.times; |
| | | this.option.series[0].data = res.data.datas[0]['e1']; |
| | | this.option.series[1].data = res.data.datas[1]['e1']; |
| | | PM25.setOption(this.option, false); |
| | | window.onresize = PM25.resize; |
| | | PM25.hideLoading(); |
| | | }); |
| | | } |
| | | |
| | | ngOnInit() { |
| | | const searchData = []; |
| | | for (let i = 0; i < 50; i += 1) { |
| | | searchData.push({ |
| | | index: i + 1, |
| | | point: `监测站点-${i}`, |
| | | value: Math.floor(Math.random() * 100) |
| | | }); |
| | | } |
| | | |
| | | const offlineChartData = []; |
| | | for (let i = 0; i < 20; i += 1) { |
| | | offlineChartData.push({ |
| | | x: new Date().getTime() + 1000 * 60 * 30 * i, |
| | | y1: Math.floor(Math.random() * 100) + 10, |
| | | y2: Math.floor(Math.random() * 100) + 10 |
| | | }); |
| | | } |
| | | this.offlineChartData = offlineChartData; |
| | | } |
| | | |
| | | ngOnDestroy(): void { |
| | |
| | | }
|
| | | ]
|
| | | };
|
| | | public type = 'warning';
|
| | | ngOnInit() {
|
| | | this.initWarning();
|
| | | }
|
| | |
| | | "use-host-property-decorator": true, |
| | | "no-input-rename": false, |
| | | "no-output-rename": false, |
| | | "use-life-cycle-interface": true, |
| | | "use-pipe-transform-interface": true, |
| | | "component-class-suffix": true, |
| | | "directive-class-suffix": true, |