From 471bedfcc8adf55098b67c40c3a467753c11857f Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Mon, 23 Jul 2018 16:57:31 +0800
Subject: [PATCH] 环比 效果图
---
src/app/routes/forecasting-warning/forecasting-warning.component.ts | 3 ++-
src/app/routes/statistics/analysis/analysis.component.ts | 32 ++++++++++++++++++++++++--------
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/src/app/routes/forecasting-warning/forecasting-warning.component.ts b/src/app/routes/forecasting-warning/forecasting-warning.component.ts
index 3f9c2fb..2e660eb 100644
--- a/src/app/routes/forecasting-warning/forecasting-warning.component.ts
+++ b/src/app/routes/forecasting-warning/forecasting-warning.component.ts
@@ -170,7 +170,8 @@
const PM2_5 = []; const PM10 = []; const CO = []; const NO2 = []; const O3 = []; const SO2 = [];
const title = '������������������';
this.option.xAxis.data = [];
- this.http.get(environment.SERVER_BASH_URL + 'demo/list').subscribe((res: any) => {
+ const params = {size: '7'};
+ this.http.get(environment.SERVER_BASH_URL + 'demo/list', {params: params}).subscribe((res: any) => {
res.forEach(data => {
const json = JSON.parse(data.aqi_json);
PM2_5.push(json.PM2_5);
diff --git a/src/app/routes/statistics/analysis/analysis.component.ts b/src/app/routes/statistics/analysis/analysis.component.ts
index 4426108..7f20f09 100644
--- a/src/app/routes/statistics/analysis/analysis.component.ts
+++ b/src/app/routes/statistics/analysis/analysis.component.ts
@@ -1,3 +1,4 @@
+import { environment } from '../../../../environments/environment';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
import { _HttpClient } from '@delon/theme';
@@ -26,18 +27,33 @@
ngOnInit() {
const offlineChartData1 = [];
const offlineChartData2 = [];
- for (let i = 0; i < 20; i += 1) {
+ const params = {size: '24'};
+ this.http2.get(environment.SERVER_BASH_URL + 'demo/compare', {params: params}).subscribe((res: any) => {
+ res.forEach(data => {
offlineChartData1.push({
- x: new Date().getTime() + 1000 * 60 * 30 * i,
- y1: Math.floor(Math.random() * 100) + 10,
- y2: Math.floor(Math.random() * 100) + 10
+ x: data.time,
+ y1: data.this_month_PM2_5,
+ y2: data.last_month_PM2_5
});
offlineChartData2.push({
- x: new Date().getTime() + 1000 * 60 * 30 * i,
- y1: Math.floor(Math.random() * 100) + 10,
- y2: Math.floor(Math.random() * 100) + 10
+ x: data.time,
+ y1: data.this_month_PM10,
+ y2: data.last_month_PM10
});
- }
+ });
+ });
+// for (let i = 0; i < 20; i += 1) {
+// offlineChartData1.push({
+// x: new Date().getTime() + 1000 * 60 * 30 * i,
+// y1: Math.floor(Math.random() * 100) + 10,
+// y2: Math.floor(Math.random() * 100) + 10
+// });
+// offlineChartData2.push({
+// x: new Date().getTime() + 1000 * 60 * 30 * i,
+// y1: Math.floor(Math.random() * 100) + 10,
+// y2: Math.floor(Math.random() * 100) + 10
+// });
+// }
this.offlineChartData1 = offlineChartData1;
this.offlineChartData2 = offlineChartData2;
}
--
Gitblit v1.8.0