Browse Source

[完善]数据过大时柱状图显示

dev
邵佳豪 3 years ago
parent
commit
4152f70833
  1. 67
      src/app/pages/home-page/home-page.component.ts
  2. 4
      src/app/pages/today-warning-admin/today-warning-admin.component.ts
  3. 4
      src/app/pages/today-warning/today-warning.component.ts

67
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);
}
//获取统计信息

4
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',

4
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'

Loading…
Cancel
Save