From 7d210afd7f9beccae57f5d234fbbb5dc3e07f435 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Mon, 30 Jul 2018 09:06:23 +0800 Subject: [PATCH] Merge branch 'master' of http://blit.7drlb.com:8888/r/screen_demo2 --- src/app/layout/default/header/header.component.html | 10 +- src/app/routes/reports/query2/query2.component.ts | 2 src/app/routes/forecasting-warning/forecasting-warning.component.html | 1 src/app/routes/forecasting-warning/forecasting-warning.component.ts | 121 +++++++++++++++++++++++++++++++++++++++ src/app/routes/reports/query2/query2.component.html | 2 5 files changed, 127 insertions(+), 9 deletions(-) diff --git a/src/app/layout/default/header/header.component.html b/src/app/layout/default/header/header.component.html index 1c81766..907e9d4 100644 --- a/src/app/layout/default/header/header.component.html +++ b/src/app/layout/default/header/header.component.html @@ -21,19 +21,19 @@ </li> --> <!-- Lock Page --> - <li class="hidden-xs"> + <!-- <li class="hidden-xs"> <div class="item" [routerLink]="['/pages/lock']"> <i class="anticon anticon-lock"></i> </div> - </li> + </li> --> <!-- Search Button --> - <li class="header-search__btn" (click)="searchToggleChange()"> + <!-- <li class="header-search__btn" (click)="searchToggleChange()"> <div class="item"> <i class="anticon anticon-search"></i> </div> - </li> + </li> --> </ul> - <header-search class="header-search" [toggleChange]="searchToggleStatus"></header-search> + <!-- <header-search class="header-search" [toggleChange]="searchToggleStatus"></header-search> --> <ul class="top-nav"> <!-- Notify --> <!-- diff --git a/src/app/routes/forecasting-warning/forecasting-warning.component.html b/src/app/routes/forecasting-warning/forecasting-warning.component.html index 8a0034a..02a081a 100644 --- a/src/app/routes/forecasting-warning/forecasting-warning.component.html +++ b/src/app/routes/forecasting-warning/forecasting-warning.component.html @@ -26,6 +26,7 @@ <div nz-col [nzSpan]="12"><div id="forecasting_humidity" style="height: 300px; width: 100%"></div></div> <div nz-col [nzSpan]="12"><div id="forecasting_pressure" style="height: 300px; width: 100%"></div></div> <div nz-col [nzSpan]="12"><div id="forecasting_uvi" style="height: 300px; width: 100%"></div></div> + <div nz-col [nzSpan]="12"><div id="forecasting_wind" style="height: 300px; width: 100%"></div></div> <!-- 15��� --> <div nz-col [nzSpan]="12"><div id="forecasting_temp_day" style="height: 300px; width: 100%"></div></div> diff --git a/src/app/routes/forecasting-warning/forecasting-warning.component.ts b/src/app/routes/forecasting-warning/forecasting-warning.component.ts index b8bf208..bd33a04 100644 --- a/src/app/routes/forecasting-warning/forecasting-warning.component.ts +++ b/src/app/routes/forecasting-warning/forecasting-warning.component.ts @@ -19,9 +19,10 @@ } [x: string]: any; - + public isShow = true; colors = ['#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622', '#bda29a', '#6e7074', '#546570', '#c4ccd3']; + public option = { title: { text: '', @@ -56,6 +57,113 @@ } ] }; + windOption = { + title: { + text: '������������������(������)', + left: 'center' + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross' + }, + formatter: function(params) { + const directionName = { + W: '���', + WSW: '������������', + SW: '������', + SSW: '������������', + S: '���', + SSE: '������������', + SE: '������', + ESE: '������������', + E: '���', + ENE: '������������', + NE: '������', + NNE: '������������', + N: '���', + NNW: '������������', + NW: '������', + WNW: '������������', + }; + return [ + params[0].value[0], + '���������' + params[0].value[1] + '���', + '���������' + directionName[params[0].value[2]] + ].join('<br>'); + } + }, + xAxis: { + type: 'category', + boundaryGap: true + }, + yAxis: { + name: '���������������' + }, + series: [ + { + type: 'custom', + renderItem: this.renderArrow, + data: [], + z: 10 + }, { + type: 'line', + smooth: true, + symbol: 'none', + itemStyle: { + color: '#6e7074' + }, + lineStyle: { + normal: { +// type: 'dotted' + } + }, + areaStyle: { + normal: {} + }, + data: [], + z: 1 + } + ] + }; + renderArrow(param, api) { + const directionMap = {}; + const direction = ['W', 'WSW', 'SW', 'SSW', 'S', 'SSE', 'SE', 'ESE', 'E', 'ENE', 'NE', 'NNE', 'N', 'NNW', 'NW', 'WNW']; + + direction.forEach((data, i) => { + directionMap[data] = Math.PI / 8 * i; + }); + + const dims = { + time: 0, + windSpeed: 1, + R: 2 + }; + const arrowSize = 18; + const point = api.coord([ + api.value(dims.time), + api.value(dims.windSpeed) + ]); + + return { + type: 'path', + shape: { + pathData: 'M31 16l-15-15v9h-26v12h26v9z', + x: -arrowSize / 2, + y: -arrowSize / 2, + width: arrowSize, + height: arrowSize + }, + rotation: directionMap[api.value(dims.R)], + position: point, + style: api.style({ + stroke: '#555', + lineWidth: 1 + }) + }; + } + + public type = 'warning'; ngOnInit() { this.initWarning(); @@ -79,6 +187,7 @@ const pressure = []; const uvi = []; const title = '������������������'; + const windDirDatas = []; zip( this.http.get('http://sapi.7drlb.com/api/mj?cityID=1102&apiKey=forecast15days'), this.http.get('http://sapi.7drlb.com/api/mj?cityID=1102&apiKey=forecast24hours') @@ -91,7 +200,9 @@ humidity.push(data.humidity); pressure.push(data.pressure); uvi.push(data.uvi); - this.option.xAxis.data.push(data.date.substring(data.date.length - 2) + '���' + data.hour + '���'); + const formatTime = data.date.substring(data.date.length - 2) + '���' + data.hour + '���'; + windDirDatas.push([formatTime, data.windSpeed, data.windDir]); + this.option.xAxis.data.push(formatTime); } }); const forecasting_tempChart = echarts.init(document.getElementById('forecasting_temp')); @@ -120,6 +231,11 @@ this.option.series[0].data = uvi; this.option.series[0].itemStyle.color = this.colors[3]; forecasting_uviChart.setOption(this.option, false); + + const forecasting_windChart = echarts.init(document.getElementById('forecasting_wind')); + this.windOption.series[0].data = windDirDatas; + this.windOption.series[1].data = windDirDatas; + forecasting_windChart.setOption(this.windOption, false); const daydatas = daysRes['data'].forecast; const temp_day = []; @@ -162,6 +278,7 @@ forecasting_humidityChart.resize(); forecasting_pressureChart.resize(); forecasting_uviChart.resize(); + forecasting_windChart.resize(); forecasting_temp_dayChart.resize(); }); }); diff --git a/src/app/routes/reports/query2/query2.component.html b/src/app/routes/reports/query2/query2.component.html index 79f0ddd..69fbdeb 100644 --- a/src/app/routes/reports/query2/query2.component.html +++ b/src/app/routes/reports/query2/query2.component.html @@ -25,7 +25,7 @@ <th nz-th><span>������</span></th> <th nz-th><span>������������</span></th> <th nz-th class="text-right"> - <span>������������ mg/m3</span> + <span>������������ {{sensorKey == 'e10'?'mg/m3':'ug/m3'}}</span> <nz-table-sort (nzValueChange)="sort('avg',$event)"></nz-table-sort> </th> </tr> diff --git a/src/app/routes/reports/query2/query2.component.ts b/src/app/routes/reports/query2/query2.component.ts index 738bf9e..190a68d 100644 --- a/src/app/routes/reports/query2/query2.component.ts +++ b/src/app/routes/reports/query2/query2.component.ts @@ -220,7 +220,7 @@ this._dataSet = this.sensorData[sensorKey]; } else { this.loading = true; - const params = {sensorKey: sensorKey, dimension: 'monitorPoint', regionCode: '320583', accountId: '1', timeType: 'month'}; + const params = {sensorKey: sensorKey, dimension: 'monitorPoint', regionCode: '320583', accountId: '1', timeType: 'day'}; this.http2.get(environment.SERVER_BASH_URL + 'screen/region_ranking_data', {params: params}).subscribe((res: any) => { this._dataSet = this.sensorData[sensorKey] = res.data; this.loading = false; -- Gitblit v1.8.0