Browse Source

[修正] echarts监听页面分辨率变化 重新渲染

master
陈鹏飞 4 years ago
parent
commit
6355169a5f
  1. 22
      src/app/statistic-analysis/home/home.component.ts

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

@ -14,7 +14,6 @@ export class HomeComponent implements OnInit {
constructor(private http:HttpClient, private render2: Renderer2,public element: ElementRef,private router: Router,public emitService: EchartsDataService) { } constructor(private http:HttpClient, private render2: Renderer2,public element: ElementRef,private router: Router,public emitService: EchartsDataService) { }
map:any; //地图 map:any; //地图
ngOnInit() { ngOnInit() {
this.emitService.eventEmit.subscribe((value: any) => { this.emitService.eventEmit.subscribe((value: any) => {
@ -24,25 +23,18 @@ export class HomeComponent implements OnInit {
}, 500); }, 500);
} }
}); });
window.addEventListener('resize', () => {
setTimeout(() => {
this.updateEcharts()
}, 0);
})
window.setTimeout(()=>{ window.setTimeout(()=>{
this.unitType() this.unitType()
this.unitData() this.unitData()
this.keyUnit() this.keyUnit()
this.mapInit() //初始化地图 this.mapInit() //初始化地图
let that = this
},0) },0)
window.addEventListener('resize', () => {
setTimeout(() => {
this.updateEcharts()
}, 500);
})
window.addEventListener('keydown', (e) => {
if(e.keyCode == 122){
setTimeout(() => {
this.updateEcharts()
}, 500);
}
})
} }
//更新echarts视图 //更新echarts视图
@ -57,7 +49,7 @@ export class HomeComponent implements OnInit {
this.unitType() this.unitType()
this.unitData() this.unitData()
this.keyUnit() this.keyUnit()
// this.mapInit() //初始化地图
} }
threePlan(){ threePlan(){

Loading…
Cancel
Save