陈鹏飞 4 years ago
parent
commit
2c09ed0a13
  1. 13
      src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.ts
  2. 11
      src/app/statistic-analysis/home/home.component.ts

13
src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.ts

@ -17,8 +17,19 @@ export class AddUnitOneComponent implements OnInit {
this.setTimeoutObj = window.setTimeout(()=>{
this.initCharts()
},0)
}
this.echartsData.eventEmit.subscribe((value: any) => {
if (value == 'echarts') {
setTimeout(() => {
this.indexBzt.resize()
}, 500);
}
});
}
//更新echarts视图
updateEcharts(){
this.indexBzt.resize()
}
//组件销毁时
ngOnDestroy(){
window.clearTimeout(this.setTimeoutObj);

11
src/app/statistic-analysis/home/home.component.ts

@ -4,7 +4,6 @@ import { Router } from '@angular/router';
import { EchartsDataService } from '../echarts-data.service';
declare var echarts: any;
declare var AMap: any;
declare var AMapUI: any;
@Component({
selector: 'app-home',
@ -20,26 +19,30 @@ export class HomeComponent implements OnInit {
ngOnInit() {
this.emitService.eventEmit.subscribe((value: any) => {
if (value == 'echarts') {
setTimeout(() => {
this.updateEcharts()
}, 500);
}
});
window.setTimeout(()=>{
this.unitType()
this.unitData()
this.keyUnit()
this.mapInit() //初始化地图
let that = this
},0)
window.addEventListener('resize', () => {
setTimeout(() => {
this.updateEcharts()
}, 500);
})
window.addEventListener('keydown', (e) => {
if(e.keyCode == 122){
setTimeout(() => {
this.updateEcharts()
}, 500);
}
})
},0)
}
//更新echarts视图

Loading…
Cancel
Save