Browse Source

[完善] echarts图表完善

master
陈鹏飞 4 years ago
parent
commit
347f9e7bda
  1. 15
      src/app/statistic-analysis/echarts-data.service.ts
  2. 13
      src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts
  3. 10
      src/app/statistic-analysis/state/page-zhong-dui-details/page-zhong-dui-details.component.ts

15
src/app/statistic-analysis/echarts-data.service.ts

@ -0,0 +1,15 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class EchartsDataService {
constructor() { }
//预案状态分析
statefulInspectionName:string;
}

13
src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts

@ -1,6 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Router,ActivatedRoute } from '@angular/router'
import { PageZhongDuiDetailsComponent } from '../page-zhong-dui-details/page-zhong-dui-details.component';
import {EchartsDataService} from '../../echarts-data.service'
declare var echarts: any;
@Component({
selector: 'app-page-two-name',
@ -9,7 +10,7 @@ declare var echarts: any;
})
export class PageTwoNameComponent implements OnInit {
constructor(private router:Router,private route:ActivatedRoute) { }
constructor(private router:Router,private route:ActivatedRoute,public data:EchartsDataService) { }
@ViewChild('zhongDuiChild') zhongDuiChild:PageZhongDuiDetailsComponent; //父组件中获得子组件的引用
@ -87,8 +88,8 @@ export class PageTwoNameComponent implements OnInit {
};
addEchart.setOption(option);
addEchart.on('click', function (params) {
_this.data.statefulInspectionName = '预案新增'
_this.isTrue = !_this.isTrue
_this.zhongDuiChild.detailEcharts("预案新增")
});
}
//预案审核通过
@ -124,8 +125,8 @@ export class PageTwoNameComponent implements OnInit {
};
passPlanEchart.setOption(option);
passPlanEchart.on('click', function (params) {
_this.data.statefulInspectionName = '预案审核通过'
_this.isTrue = !_this.isTrue
_this.zhongDuiChild.detailEcharts("预案审核通过")
});
}
@ -162,8 +163,8 @@ export class PageTwoNameComponent implements OnInit {
};
passMakeEchart.setOption(option);
passMakeEchart.on('click', function (params) {
_this.data.statefulInspectionName = '预案编制'
_this.isTrue = !_this.isTrue
_this.zhongDuiChild.detailEcharts("预案编制")
});
}
@ -200,8 +201,8 @@ export class PageTwoNameComponent implements OnInit {
};
passBackEchart.setOption(option);
passBackEchart.on('click', function (params) {
_this.data.statefulInspectionName = '预案审核退回'
_this.isTrue = !_this.isTrue
_this.zhongDuiChild.detailEcharts("预案审核退回")
});
}
@ -238,8 +239,8 @@ export class PageTwoNameComponent implements OnInit {
};
planAuditEchart.setOption(option);
planAuditEchart.on('click', function (params) {
_this.data.statefulInspectionName = '预案审核中'
_this.isTrue = !_this.isTrue
_this.zhongDuiChild.detailEcharts("预案审核中")
});
}
//预案状态统计

10
src/app/statistic-analysis/state/page-zhong-dui-details/page-zhong-dui-details.component.ts

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import {EchartsDataService} from '../../echarts-data.service'
declare var echarts: any;
@Component({
selector: 'app-page-zhong-dui-details',
@ -8,19 +9,22 @@ declare var echarts: any;
})
export class PageZhongDuiDetailsComponent implements OnInit {
constructor( public route: ActivatedRoute) { }
constructor( public route: ActivatedRoute,public data: EchartsDataService) { }
zhongNameData = ["浦东中队","黄埔中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"]
zhongNumData = [200,190,180,170,160,150,140,130,120,110,100]
ngOnInit(): void {
window.setTimeout(()=>{
this.detailEcharts()
})
}
detailEcharts(title){
detailEcharts(){
var detailPlanEchart = echarts.init(document.getElementById('detailBox'));
var option = {
title: {
text: title,
text: this.data.statefulInspectionName,
left: "center",
textStyle: {
fontSize: 28

Loading…
Cancel
Save