From 4152f708336e93c2837eed6042b8fc0ce3432fac Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Mon, 20 Dec 2021 09:06:59 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E6=95=B0=E6=8D=AE=E8=BF=87?= =?UTF-8?q?=E5=A4=A7=E6=97=B6=E6=9F=B1=E7=8A=B6=E5=9B=BE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/home-page/home-page.component.ts | 67 ++++++++++++++++--- .../today-warning-admin.component.ts | 4 +- .../today-warning/today-warning.component.ts | 4 +- 3 files changed, 61 insertions(+), 14 deletions(-) diff --git a/src/app/pages/home-page/home-page.component.ts b/src/app/pages/home-page/home-page.component.ts index eae4f74..902e79a 100644 --- a/src/app/pages/home-page/home-page.component.ts +++ b/src/app/pages/home-page/home-page.component.ts @@ -159,17 +159,17 @@ export class HomePageComponent implements OnInit { label: { normal: { show: true, - // formatter: function (dataObj) { - // const { dataIndex, value } = dataObj; - // let labelText = value; + formatter: function (dataObj) { + const { dataIndex, value } = dataObj; + let labelText = value; - // labelText = ''; - // if (dataIndex % 2 === 0) { // 每隔三个x坐标显示一个 - // labelText = value; - // } + labelText = ''; + if (dataIndex % 1 === 0) { // 每隔三个x坐标显示一个 + labelText = value; + } - // return `${labelText}` - // } + return `${labelText}` + } } }, @@ -331,7 +331,20 @@ export class HomePageComponent implements OnInit { symbol: 'circle', symbolSize: 8, label: { - show: true + normal: { + show: true, + formatter: function (dataObj) { + const { dataIndex, value } = dataObj; + let labelText = value; + + labelText = ''; + if (dataIndex % 1 === 0) { // 每隔三个x坐标显示一个 + labelText = value; + } + + return `${labelText}` + } + } }, itemStyle: { color: '#fff', @@ -496,6 +509,23 @@ export class HomePageComponent implements OnInit { this.warningechartbarOption.xAxis.data = monthArr this.warningechartbarOption.series[0].data = valuedata this.warningechartbarOption.series[1].data = valuedata + let xxx = valuedata.find(function (value, index, arr) { + return value > 1000; + }) + if (xxx) { + // console.log('xxxxxxxxxx') + this.warningechartbarOption.series[1].label.normal.formatter = function (dataObj) { + const { dataIndex, value } = dataObj; + let labelText = value; + + labelText = ''; + if (dataIndex % 2 === 0) { // 每隔三个x坐标显示一个 + labelText = value; + } + + return `${labelText}` + } + } this.warningechartbar.setOption(this.warningechartbarOption); @@ -526,6 +556,23 @@ export class HomePageComponent implements OnInit { this.oilchartbarOption.xAxis.data = monthArr this.oilchartbarOption.series[0].data = valuedata this.oilchartbarOption.series[1].data = valuedata + let xxx = valuedata.find(function (value, index, arr) { + return value > 1000; + }) + if (xxx) { + // console.log('xxxxxxxxxx') + this.warningechartbarOption.series[1].label.normal.formatter = function (dataObj) { + const { dataIndex, value } = dataObj; + let labelText = value; + + labelText = ''; + if (dataIndex % 2 === 0) { // 每隔三个x坐标显示一个 + labelText = value; + } + + return `${labelText}` + } + } this.oilchartbar.setOption(this.oilchartbarOption); } //获取统计信息 diff --git a/src/app/pages/today-warning-admin/today-warning-admin.component.ts b/src/app/pages/today-warning-admin/today-warning-admin.component.ts index 01e11e0..ce72c52 100644 --- a/src/app/pages/today-warning-admin/today-warning-admin.component.ts +++ b/src/app/pages/today-warning-admin/today-warning-admin.component.ts @@ -118,8 +118,8 @@ export class TodayWarningAdminComponent implements OnInit { ViolationIds: ViolationIds, ViolateArea: this.validateForm.value.area, organizationUnitId: this.validateForm.value.organization, - // ViolateTime: (this.validateForm.value.datePickerEnd && this.validateForm.value.datePickerStart) ? [moment(this.validateForm.value.datePickerStart).format('yyyy-MM-DD HH:mm:ss'), moment(this.validateForm.value.datePickerEnd).format('yyyy-MM-DD HH:mm:ss')] : null, - ViolateTime: ['2021-10-27', '2021-11-26'], + ViolateTime: (this.validateForm.value.datePickerEnd && this.validateForm.value.datePickerStart) ? [moment(this.validateForm.value.datePickerStart).format('yyyy-MM-DD HH:mm:ss'), moment(this.validateForm.value.datePickerEnd).format('yyyy-MM-DD HH:mm:ss')] : null, + // ViolateTime: ['2021-10-27', '2021-11-26'], IsHandled: disposalState, IsContainsChildren: 'true', SkipCount: '0', diff --git a/src/app/pages/today-warning/today-warning.component.ts b/src/app/pages/today-warning/today-warning.component.ts index 6c0df6a..5f4e570 100644 --- a/src/app/pages/today-warning/today-warning.component.ts +++ b/src/app/pages/today-warning/today-warning.component.ts @@ -75,9 +75,9 @@ export class TodayWarningComponent implements OnInit { ViolationIds: ViolationIds, ViolateArea: this.validateForm.value.area, organizationUnitId: JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id, - // ViolateTime: (this.validateForm.value.datePickerEnd && this.validateForm.value.datePickerStart) ? [moment(this.validateForm.value.datePickerStart).format('yyyy-MM-DD HH:mm:ss'), moment(this.validateForm.value.datePickerEnd).format('yyyy-MM-DD HH:mm:ss')] : null, + ViolateTime: (this.validateForm.value.datePickerEnd && this.validateForm.value.datePickerStart) ? [moment(this.validateForm.value.datePickerStart).format('yyyy-MM-DD HH:mm:ss'), moment(this.validateForm.value.datePickerEnd).format('yyyy-MM-DD HH:mm:ss')] : null, IsHandled: disposalState, - ViolateTime: ['2021-10-27', '2021-11-26'], + // ViolateTime: ['2021-10-27', '2021-11-26'], IsContainsChildren: 'true', SkipCount: '0', MaxResultCount: '9999'