From c5ed2fc881b779409e8c8c7742754432fad314d5 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 4 Sep 2020 13:39:08 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E5=8D=95=E4=BD=8D=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=9F=BA=E6=9C=AC=E5=AE=8C=E6=88=90=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8D=95=E4=BD=8D=E7=BB=9F=E8=AE=A1=E5=AE=8C=E6=88=90?= =?UTF-8?q?50%=EF=BC=8C=E5=B0=81=E8=A3=85=E6=8F=90=E7=A4=BA=E6=A1=86?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../add-unit-one/add-unit-one.component.html | 4 + .../add-unit-one/add-unit-one.component.scss | 8 + .../add-unit-one.component.spec.ts | 25 ++ .../add-unit-one/add-unit-one.component.ts | 124 ++++++++ .../add-unit-two-time.component.html | 90 ++++++ .../add-unit-two-time.component.scss | 63 ++++ .../add-unit-two-time.component.spec.ts | 25 ++ .../add-unit-two-time.component.ts | 296 +++++++++++++++++ .../add-unit-two-type-details.component.html | 13 + .../add-unit-two-type-details.component.scss | 42 +++ ...dd-unit-two-type-details.component.spec.ts | 25 ++ .../add-unit-two-type-details.component.ts | 111 +++++++ ...dd-unit-two-type-statistics.component.html | 32 ++ ...dd-unit-two-type-statistics.component.scss | 45 +++ ...unit-two-type-statistics.component.spec.ts | 25 ++ .../add-unit-two-type-statistics.component.ts | 297 +++++++++++++++++ .../building-type-one.component.html | 5 +- .../building-type-one.component.scss | 8 + .../building-type-one.component.ts | 115 ++++++- ...building-type-three-details.component.html | 13 + ...building-type-three-details.component.scss | 38 +++ ...lding-type-three-details.component.spec.ts | 25 ++ .../building-type-three-details.component.ts | 110 +++++++ .../building-type-two-forward.component.html | 31 ++ .../building-type-two-forward.component.scss | 41 +++ ...uilding-type-two-forward.component.spec.ts | 25 ++ .../building-type-two-forward.component.ts | 298 ++++++++++++++++++ .../building-type-two-reverse.component.html | 32 ++ .../building-type-two-reverse.component.scss | 41 +++ ...uilding-type-two-reverse.component.spec.ts | 25 ++ .../building-type-two-reverse.component.ts | 296 +++++++++++++++++ .../echarts-data.service.ts | 129 ++++++++ .../state/page-one/page-one.component.scss | 2 +- .../state/page-one/page-one.component.ts | 3 +- .../page-two-name/page-two-name.component.ts | 2 - .../page-two-time.component.scss | 2 +- .../statistic-analysis-routing.module.ts | 16 +- .../statistic-analysis.module.ts | 9 +- 38 files changed, 2479 insertions(+), 12 deletions(-) create mode 100644 src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.html create mode 100644 src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.scss create mode 100644 src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.spec.ts create mode 100644 src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.ts create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.html create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.scss create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.spec.ts create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.ts create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.html create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.scss create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.spec.ts create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.ts create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.html create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.scss create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.spec.ts create mode 100644 src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.ts create mode 100644 src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.html create mode 100644 src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.scss create mode 100644 src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.spec.ts create mode 100644 src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.ts create mode 100644 src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.html create mode 100644 src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.scss create mode 100644 src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.spec.ts create mode 100644 src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.ts create mode 100644 src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.html create mode 100644 src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.scss create mode 100644 src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.spec.ts create mode 100644 src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.ts diff --git a/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.html b/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.html new file mode 100644 index 0000000..b560d1b --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.html @@ -0,0 +1,4 @@ + + +
+ \ No newline at end of file diff --git a/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.scss b/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.scss new file mode 100644 index 0000000..1bffad0 --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.scss @@ -0,0 +1,8 @@ +.tishi{ + width: 100%; + height: 100%; + span{ + font-size: 25px; + text-align: center; + } +} \ No newline at end of file diff --git a/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.spec.ts b/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.spec.ts new file mode 100644 index 0000000..a7c2ab3 --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddUnitOneComponent } from './add-unit-one.component'; + +describe('AddUnitOneComponent', () => { + let component: AddUnitOneComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AddUnitOneComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AddUnitOneComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.ts b/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.ts new file mode 100644 index 0000000..34673d9 --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.ts @@ -0,0 +1,124 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +declare var echarts: any; +@Component({ + selector: 'app-add-unit-one', + templateUrl: './add-unit-one.component.html', + styleUrls: ['./add-unit-one.component.scss'] +}) +export class AddUnitOneComponent implements OnInit { + + constructor(private router: Router) { } + + ngOnInit(): void { + window.setTimeout(()=>{ + this.initCharts() + },0) + } + /* 首页饼状图 */ + initCharts(){ + let indexBzt = echarts.init(document.getElementById('indexBzt')); + let options={ + title: { + text: '新增单位统计(8900家)', + left: 'center', + top: "7%", + textStyle: { + fontSize:31 + } + }, + tooltip: { + trigger: 'item', + formatter: (params)=>{ + return this.biaogeTishi(params.name) + }, + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0' + }, + legend: { + orient: 'vertical', + right: 150, + top:80, + data: ['高层', '地下', '轨道交通', '化工生产', '储罐类' , '厂房','古建筑', '商市场', '医院', '学校', '宾馆' , '娱乐场所','餐饮业', '影剧院', '展览建筑' , '隧道'] + }, + series: [ + { + name: '访问来源', + type: 'pie', + radius: '60%', + center: ['50%', '53%'], + label:{ + show:true, + fontSize:13, + formatter:'{b}{c}家\n{d|({d}%)}', + rich: { + d: { + align: 'center', + } + }, + }, + data: [ + {value: 500, name: '高层'}, + {value: 800, name: '地下'}, + {value: 900, name: '轨道交通'}, + {value: 800, name: '化工生产'}, + {value: 1200, name: '储罐类'}, + {value: 1500, name: '厂房'}, + {value: 1400, name: '古建筑'}, + {value: 600, name: '商市场'}, + {value: 568, name: '医院'}, + {value: 888, name: '学校'}, + {value: 485, name: '宾馆'}, + {value: 966, name: '娱乐场所'}, + {value: 789, name: '餐饮业'}, + {value: 500, name: '影剧院'}, + {value: 1025, name: '展览建筑'}, + {value: 600, name: '隧道'} + ], + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + } + } + ] + }; + indexBzt.on('click', (params) => { + this.router.navigateByUrl('/statisticanalysis/addUnit_one/addUnit_two_type'); + }); + indexBzt.setOption(options); + } + biaogeTishi(biaotou:string){ + var shuju='[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄埔支队","number":"144","zhanbi":"2.8%"},' + shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' + shuju+='{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},' + shuju+='{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},' + shuju+='{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},' + shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' + shuju+='{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},' + shuju+='{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]' + var jsonObj = JSON.parse(shuju); + var res = '
'+biaotou+'
' + res+='
'; + res+=''; + res+=''; + res+='' + res+='' + res+='' + res+=''; + for(var i=0;i' + res+='' + res+='' + } + + res+='' + res+='' + res+='
名称数量总占比
'+jsonObj[i].number+''+jsonObj[i].zhanbi+'
总计135619%
' + return res + } +} diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.html b/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.html new file mode 100644 index 0000000..9e608b0 --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.html @@ -0,0 +1,90 @@ +
+
+
+ + + + +
+ +
+
+ 开始年份: + + + {{item}} + + + 开始月份: + + + {{item}} + + + 结束年份: + + + {{item}} + + + 结束月份: + + + {{item}} + + + +
+
+ +
+
+ 开始年份: + + + {{item}} + + + 结束年份: + + + {{item}} + + + +
+
+ + +
+ + +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.scss b/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.scss new file mode 100644 index 0000000..f17d954 --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.scss @@ -0,0 +1,63 @@ +.box{ + width: 100%; + height: 92%; + display: flex; + flex-direction: column; + overflow: hidden; + position: relative; + .echartsbox{ + width: 100%; + height: 100%; + overflow: auto; + } + #Line{ + width: 50%; + height: 420px; + margin: 50px auto; + } +} +.publicCss{ + height: 350px; + width: 50%; + display: inline-block; + box-sizing: border-box; + padding: 20px; +} + +//头部搜索栏 +.header { + border-bottom: 1px solid #999; + height: 80px; + min-height: 81px;; + box-sizing: border-box; + // padding: 0 15px; + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items:center; + justify-content:center; + .queryField { + margin: 0 10px; + font-size: 14px; + .mat-form-field { + width: 130px; + max-height: 50px;; + margin: 0 15px 0 10px; + } + } + .btnbox{ + height: 80px; + display: flex; + flex-direction:column; + justify-content: space-around; + position: fixed; + top: 64px; + right: 4%; + width: 88px; + button{ + width: 88px; + height: 36px; + } + + } + } \ No newline at end of file diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.spec.ts b/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.spec.ts new file mode 100644 index 0000000..929c56d --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddUnitTwoTimeComponent } from './add-unit-two-time.component'; + +describe('AddUnitTwoTimeComponent', () => { + let component: AddUnitTwoTimeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AddUnitTwoTimeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AddUnitTwoTimeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.ts b/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.ts new file mode 100644 index 0000000..8cb7df2 --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.ts @@ -0,0 +1,296 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; +import { EchartsDataService } from '../../echarts-data.service'; +declare var echarts: any; +@Component({ + selector: 'app-add-unit-two-time', + templateUrl: './add-unit-two-time.component.html', + styleUrls: ['./add-unit-two-time.component.scss'] +}) +export class AddUnitTwoTimeComponent implements OnInit { + forward(){ + this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type']) + } + reverse(){ + this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time']) + } + constructor(private router: Router,public dialog: MatDialog,public snackBar: MatSnackBar,private serviceData: EchartsDataService) { } + + ngOnInit(): void { + this.dateInit () + setTimeout(() => { + this.oneInit (this.date,this.dateNum) + this.twoInit (this.date,this.dateNum,'year') + }, 0); + } + + selectType:string = 'month'; //选择当前的 查询类型 按月/年 + + //查询数据 + years:any = [] + selectMonth:any = [1,2,3,4,5,6,7,8,9,10,11,12] + + //日期初始化 + dateInit () { + let date = (new Date()).getFullYear() + for (let i=date; i>=date-10;i--) { + this.years.unshift(i) + } + } + selectOneYear:any = (new Date()).getFullYear() //开始年份 + selectTwoYear:any = (new Date()).getFullYear() //结束年份 + selectStartMonth:any = 1 //开始月份 + selectEndMonth:any = (new Date()).getMonth()+1 //结束月份 + //按月查询 + monthSubmit (e) { + if (e.selectTwoYear > e.selectOneYear) { + let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 + let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 + console.log(startTime) + console.log(endTime) + } else if (e.selectTwoYear === e.selectOneYear) { + if(e.selectEndMonth >= e.selectStartMonth) { + let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 + let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 + console.log(startTime) + console.log(endTime) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请选择正确时间区段','确定',config); + } + }else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请选择正确时间区段','确定',config); + } + } + selectStartYear:any = (new Date()).getFullYear() //开始年份 + selectEndYear:any = (new Date()).getFullYear() //结束年份 + //按年查询 + yearSubmit (e) { + if (e.selectEndYear >= e.selectStartYear) { + let startTime = e.selectStartYear + '-' + 1 + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 + let endTime = e.selectEndYear + '-' + 12 + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 + console.log(startTime) + console.log(endTime) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请选择正确时间区段','确定',config); + } + } + //年或月点击 + dateChange(){ + this.forArr.forEach(item => { + item.echart.dispose() + }) + + if(this.selectType == "year"){ + this.oneInit(this.date2,this.dateNum2) + this.twoInit(this.date2,this.dateNum2,'year') + } + if(this.selectType == "month"){ + this.oneInit(this.date,this.dateNum) + this.twoInit(this.date,this.dateNum,'month') + } + + } + + + forArr = [{id:'gaoceng',name:'高层',echart:null}, + {id:'dixia',name:'地下',echart:null}, + {id:'guidao',name:'轨道交通',echart:null}, + {id:'huagong',name:'化工生产',echart:null}, + {id:'chuguan',name:'储罐类',echart:null}, + {id:'changfang',name:'厂房',echart:null}, + {id:'gujianzhu',name:'古建筑',echart:null}, + {id:'shichang',name:'商市场',echart:null}, + {id:'yiyuan',name:'医院',echart:null}, + {id:'xuexiao',name:'学校',echart:null}, + {id:'binguan',name:'宾馆',echart:null}, + {id:'yule',name:'娱乐场所',echart:null}, + {id:'canyin',name:'餐饮业',echart:null}, + {id:'yingyuan',name:'影剧院',echart:null}, + {id:'zhanlan',name:'展览建筑',echart:null}, + {id:'suidao',name:'隧道',echart:null}] + + + date = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月','9月'] + dateNum = [270, 253, 244, 199, 189, 173, 160, 198,200] + + date2 = ['2019', '2020'] + dateNum2 = [220, 180] + + //新增数量统计 + oneInit (date,dateNum) { + var chartQusj = echarts.init(document.getElementById('Line'), 'skinUpp'); + var option = { + grid: { + top: 70, + left:40, + right: 20, + bottom: 20, + }, + // 标题 + title: { + text: '新增数量统计', + top: -4, + left: 'center', + textStyle:{ + //文字颜色 + color:'#000', + fontSize: 22, + } + }, + //提示框 + tooltip: { + trigger: 'axis', + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0', + formatter: (params)=>{ + return this.serviceData.tableTooltip(this.serviceData.buildingType,params[0].name) + }, + position:this.serviceData.tableTooltipNoShow + }, + // x轴 + xAxis: { + type: 'category', + data: date, + axisLabel: { + color: "#000", //刻度线标签颜色 + }, + //设置坐标轴字体颜色和宽度 + axisLine: { + lineStyle: { + color: "#000", + }, + }, + splitLine: {//分割线配置 + show:true, + lineStyle: { + color: '#999', + } + } + }, + // y轴 + yAxis: { + type: 'value', + name: '个', + axisLabel: { + color: "#000" //刻度线标签颜色 + }, + //设置坐标轴字体颜色和宽度 + axisLine: { + lineStyle: { + color: "#000", + } + } + }, + // 数据 + series: [{ + name: '新增数量', + type: 'line', + data: dateNum, + } + ], + } + chartQusj.setOption(option); + } + + //剩余折线图 + twoInit (date,dateNum,typeName) { + this.forArr.forEach((item,key) => { + let that = this + item.echart = echarts.init(document.getElementById(item.id), 'skinUpp'); + var option = { + grid: { + top: 50, + left:40, + right: 20, + bottom: 20, + }, + // 标题 + title: { + text: item.name, + top: -4, + left: 'center', + textStyle:{ + //文字颜色 + color:'#000', + } + }, + //提示框 + tooltip: { + trigger: 'axis', + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0', + formatter: (params)=>{ + return this.serviceData.tableTooltip(this.serviceData.tableDataZhi,params[0].name) + } + }, + // x轴 + xAxis: { + type: 'category', + data: date, + axisLabel: { + color: "#000", //刻度线标签颜色 + }, + //设置坐标轴字体颜色和宽度 + axisLine: { + lineStyle: { + color: "#000", + }, + }, + splitLine: {//分割线配置 + show:true, + lineStyle: { + color: '#999', + } + } + }, + // y轴 + yAxis: { + type: 'value', + name: '个', + axisLabel: { + color: "#000" //刻度线标签颜色 + }, + //设置坐标轴字体颜色和宽度 + axisLine: { + lineStyle: { + color: "#000", + } + } + }, + // 数据 + series: [{ + name: typeName, + type: 'line', + data: dateNum, + } + ], + }; + item.echart.setOption(option,true); + // item.echart.on('click', (params) => { + // console.log(params) + // }); + item.echart.getZr().on('click',params=>{ + const pointInPixel= [params.offsetX, params.offsetY]; + if (item.echart.containPixel('grid',pointInPixel)) { + let xIndex=item.echart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; + /*事件处理代码书写位置*/ + console.log(option.series[0].data[xIndex],option.xAxis.data[xIndex]) + + } + }); + }) + } +} diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.html b/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.html new file mode 100644 index 0000000..8b8182f --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.html @@ -0,0 +1,13 @@ +
+
+
+ + +
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.scss b/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.scss new file mode 100644 index 0000000..9246bae --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.scss @@ -0,0 +1,42 @@ +.box{ + width: 100%; + height: 92%; + display: flex; + flex-direction: column; + overflow: hidden; + position: relative; + .topbox{ + width: 100%; + height: 80px; + min-height: 80px; + border-bottom: 1px gray solid; + .btnbox{ + height: 80px; + display: flex; + flex-direction:column; + justify-content: space-around; + position: fixed; + top: 64px; + right: 4%; + width: 88px; + button{ + width: 88px; + height: 36px; + } + + } + } + .echartsbox{ + width: 100%; + height: 100%; + overflow: auto; + #barEchart{ + width: 100%; + height: 350px; + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%,-50%); + } + } +} \ No newline at end of file diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.spec.ts b/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.spec.ts new file mode 100644 index 0000000..1a550f1 --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddUnitTwoTypeDetailsComponent } from './add-unit-two-type-details.component'; + +describe('AddUnitTwoTypeDetailsComponent', () => { + let component: AddUnitTwoTypeDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AddUnitTwoTypeDetailsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AddUnitTwoTypeDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.ts b/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.ts new file mode 100644 index 0000000..63ea6f2 --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.ts @@ -0,0 +1,111 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; +declare var echarts: any; +@Component({ + selector: 'app-add-unit-two-type-details', + templateUrl: './add-unit-two-type-details.component.html', + styleUrls: ['./add-unit-two-type-details.component.scss'] +}) +export class AddUnitTwoTypeDetailsComponent implements OnInit { + + constructor(public route: ActivatedRoute,private router: Router) { } + forward(){ + this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type']) + } + reverse(){ + this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time']) + } + + organizationName:String + buildingTypeName:String + + ngOnInit(): void { + this.route.queryParams.subscribe(params => { + this.organizationName = params['organizationName']; + this.buildingTypeName = params['buildingTypeName']; + }); + window.setTimeout(()=>{ + this.detailEcharts() + }) + } + topTextlabel = { + show: true, // 开启显示 + position: 'top', // 在上方显示 + distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 + verticalAlign: 'middle', + textStyle: { // 数值样式 + color: 'black', + fontSize: 12 + } + }//柱状图数值顶部显示 + zhongNameData = ["浦东中队","黄埔中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"] + zhongNumData = [200,190,180,170,160,150,140,130,120,110,100] + detailEcharts(){ + var detailPlanEchart = echarts.init(document.getElementById('barEchart')); + var option = { + title: { + text: this.buildingTypeName + '(' +this.organizationName + ')', + left: "center", + textStyle: { + fontSize: 28 + } + }, + xAxis: { + type: 'category', + data: this.zhongNameData, + // axisLabel: this.axisLabel + }, + yAxis: { + type: 'value' + }, + tooltip: { + trigger: 'item', + formatter: (params)=>{ + return this.tableTooltip(params) + }, + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0' + }, + series: [{ + data: this.zhongNumData, + type: 'bar', + showBackground: true, + barWidth :'58', + backgroundStyle: { + color: 'rgba(220, 220, 220, 0.8)' + }, + label: this.topTextlabel + }] + }; + detailPlanEchart.setOption(option); + } + + + tableTooltip(params:any){ + var data = [ + {name:params.name,number:params.value,zhanbi:(params.value/1340 * 100).toFixed(2) + "%"} + ] + var res = '
'+params.name+'
' + res+='
'; + res+=''; + res+=''; + res+='' + res+='' + res+='' + res+=''; + for(var i=0;i' + res+='' + res+='' + } + + res+='' + // res+='' + res+='
名称数量总占比
'+data[i].number+''+data[i].zhanbi+'
总计135619%
' + return res + } + +} diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.html b/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.html new file mode 100644 index 0000000..f2ff2ed --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.html @@ -0,0 +1,32 @@ +
+
+
+ + +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.scss b/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.scss new file mode 100644 index 0000000..b9e1ac0 --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.scss @@ -0,0 +1,45 @@ +.box{ + width: 100%; + height: 92%; + display: flex; + flex-direction: column; + overflow: hidden; + position: relative; + .topbox{ + width: 100%; + height: 80px; + min-height: 80px; + border-bottom: 1px gray solid; + .btnbox{ + height: 80px; + display: flex; + flex-direction:column; + justify-content: space-around; + position: fixed; + top: 64px; + right: 4%; + width: 88px; + button{ + width: 88px; + height: 36px; + } + + } + } + .echartsbox{ + width: 100%; + height: 100%; + overflow: auto; + } + #pie{ + width: 100%; + height: 450px; + } +} +.publicCss{ + height: 350px; + width: 50%; + display: inline-block; + box-sizing: border-box; + padding: 20px; +} \ No newline at end of file diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.spec.ts b/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.spec.ts new file mode 100644 index 0000000..475c178 --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddUnitTwoTypeStatisticsComponent } from './add-unit-two-type-statistics.component'; + +describe('AddUnitTwoTypeStatisticsComponent', () => { + let component: AddUnitTwoTypeStatisticsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AddUnitTwoTypeStatisticsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AddUnitTwoTypeStatisticsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.ts b/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.ts new file mode 100644 index 0000000..cd4ade9 --- /dev/null +++ b/src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.ts @@ -0,0 +1,297 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +declare var echarts: any; +@Component({ + selector: 'app-add-unit-two-type-statistics', + templateUrl: './add-unit-two-type-statistics.component.html', + styleUrls: ['./add-unit-two-type-statistics.component.scss'] +}) +export class AddUnitTwoTypeStatisticsComponent implements OnInit { + + constructor(private router: Router) { } + + forward(){ + this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type']) + } + reverse(){ + this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time']) + } + ngOnInit(): void { + window.setTimeout(()=>{ + this.initCharts() + this.barEcharts() + },0) + } + + axisLabel = { + interval: 0, + formatter:function(value) + { + var ret = "";//拼接加\n返回的类目项 + var maxLength = 2;//每项显示文字个数 + var valLength = value.length;//X轴类目项的文字个数 + var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数 + if (rowN > 1)//如果类目项的文字大于3, + { + for (var i = 0; i < rowN; i++) { + var temp = "";//每次截取的字符串 + var start = i * maxLength;//开始截取的位置 + var end = start + maxLength;//结束截取的位置 + //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧 + temp = value.substring(start, end) + "\n"; + ret += temp; //凭借最终的字符串 + } + return ret; + } + else { + return value; + } + } + }//echarts两个字换行 + + topTextlabel = { + show: true, // 开启显示 + position: 'top', // 在上方显示 + distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 + verticalAlign: 'middle', + textStyle: { // 数值样式 + color: 'black', + fontSize: 12 + } + }//柱状图数值顶部显示 + + tableDataZhi = [ {name:"浦东支队",number:"156",zhanbi:"3%"}, + {name:"黄埔支队",number:"144",zhanbi:"2.8%"}, + {name:"徐汇支队",number:"133",zhanbi:"2.1%"}, + {name:"长宁支队",number:"122",zhanbi:"1.6%"}, + {name:"静安支队",number:"120",zhanbi:"1.3%"}, + {name:"普陀支队",number:"100",zhanbi:"1.1%"}, + {name:"虹口支队",number:"95",zhanbi:"1%"}, + {name:"杨浦支队",number:"90",zhanbi:"0.9%"}, + {name:"闵行支队",number:"88",zhanbi:"0.8%"}, + {name:"宝山支队",number:"83",zhanbi:"0.7%"}, + {name:"徐汇支队",number:"133",zhanbi:"2.1%"}, + {name:"长宁支队",number:"122",zhanbi:"1.6%"}, + {name:"嘉定支队",number:"78",zhanbi:"0.6%"}, + {name:"松江支队",number:"75",zhanbi:"0.5%"}, + {name:"金山支队",number:"65",zhanbi:"0.4%"}, + {name:"崇明支队",number:"55",zhanbi:"0.3%"} ] + tableDataZhong = [ {name:"浦东中队",number:"156",zhanbi:"3%"}, + {name:"黄埔中队",number:"144",zhanbi:"2.8%"}, + {name:"徐汇中队",number:"133",zhanbi:"2.1%"}, + {name:"长宁中队",number:"122",zhanbi:"1.6%"}, + {name:"静安中队",number:"120",zhanbi:"1.3%"}, + {name:"普陀中队",number:"100",zhanbi:"1.1%"}, + {name:"虹口中队",number:"95",zhanbi:"1%"}, + {name:"杨浦中队",number:"90",zhanbi:"0.9%"}, + {name:"闵行中队",number:"88",zhanbi:"0.8%"}, + {name:"宝山中队",number:"83",zhanbi:"0.7%"}, + {name:"徐汇中队",number:"133",zhanbi:"2.1%"}, + {name:"长宁中队",number:"122",zhanbi:"1.6%"}, + {name:"嘉定中队",number:"78",zhanbi:"0.6%"}, + {name:"松江中队",number:"75",zhanbi:"0.5%"}, + {name:"金山中队",number:"65",zhanbi:"0.4%"}, + {name:"崇明中队",number:"55",zhanbi:"0.3%"} ] + zhiNameData = ["浦东支队","黄埔支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"] + zhiNumData = [200,190,180,170,160,150,140,130,120,110,100,90,80,70] + forArr = [{id:'gaoceng',name:'高层'}, + {id:'dixia',name:'地下'}, + {id:'guidao',name:'轨道交通'}, + {id:'huagong',name:'化工生产'}, + {id:'chuguan',name:'储罐类'}, + {id:'changfang',name:'厂房'}, + {id:'gujianzhu',name:'古建筑'}, + {id:'shichang',name:'商市场'}, + {id:'yiyuan',name:'医院'}, + {id:'xuexiao',name:'学校'}, + {id:'binguan',name:'宾馆'}, + {id:'yule',name:'娱乐场所'}, + {id:'canyin',name:'餐饮业'}, + {id:'yingyuan',name:'影剧院'}, + {id:'zhanlan',name:'展览建筑'}, + {id:'suidao',name:'隧道'}] + + /* 顶部饼状图 */ + initCharts(){ + let indexBzt = echarts.init(document.getElementById('pie')); + let options={ + title: { + text: '新增单位统计(8900家)', + left: 'center', + top: "7%", + textStyle: { + fontSize:26 + } + }, + tooltip: { + trigger: 'item', + formatter: (params)=>{ + return this.tableTooltip(this.tableDataZhi,params.name) + }, + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0', + position: function (point, params, dom, rect, size) { + // 鼠标坐标和提示框位置的参考坐标系是:以外层div的左上角那一点为原点,x轴向右,y轴向下 + // 提示框位置 + var x = 0; // x坐标位置 + var y = 0; // y坐标位置 + + // 当前鼠标位置 + var pointX = point[0]; + var pointY = point[1]; + + // 外层div大小 + // var viewWidth = size.viewSize[0]; + // var viewHeight = size.viewSize[1]; + + // 提示框大小 + var boxWidth = size.contentSize[0]; + var boxHeight = size.contentSize[1]; + + // boxWidth > pointX 说明鼠标左边放不下提示框 + if (boxWidth > pointX) { + x = 35; + } else { // 左边放的下 + x = pointX + 80; + } + + // boxHeight > pointY 说明鼠标上边放不下提示框 + if (boxHeight > pointY) { + y = 65; + } else { // 上边放得下 + y = pointY - boxHeight; + } + + return [pointX, pointY]; + } + }, + legend: { + orient: 'vertical', + right: 150, + top:80, + data: ['高层', '地下', '轨道交通', '化工生产', '储罐类' , '厂房','古建筑', '商市场', '医院', '学校', '宾馆' , '娱乐场所','餐饮业', '影剧院', '展览建筑' , '隧道'] + }, + series: [ + { + name: '访问来源', + type: 'pie', + radius: '60%', + center: ['50%', '60%'], + label:{ + show:true, + fontSize:13, + formatter:'{b}{c}家\n{d|({d}%)}', + rich: { + d: { + align: 'center', + } + }, + }, + data: [ + {value: 500, name: '高层'}, + {value: 800, name: '地下'}, + {value: 900, name: '轨道交通'}, + {value: 800, name: '化工生产'}, + {value: 1200, name: '储罐类'}, + {value: 1500, name: '厂房'}, + {value: 1400, name: '古建筑'}, + {value: 600, name: '商市场'}, + {value: 568, name: '医院'}, + {value: 888, name: '学校'}, + {value: 485, name: '宾馆'}, + {value: 966, name: '娱乐场所'}, + {value: 789, name: '餐饮业'}, + {value: 500, name: '影剧院'}, + {value: 1025, name: '展览建筑'}, + {value: 600, name: '隧道'} + ], + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + } + } + ] + }; + indexBzt.on('click', (params) => { + // this.router.navigateByUrl('/statisticanalysis/buildingType_two_forward'); + }); + indexBzt.setOption(options); + } + //柱状图 + barEcharts(){ + this.forArr.forEach(item=>{ + let _this = this + let addEchart = echarts.init(document.getElementById(item.id)); + let option = { + title: { + text: item.name, + left: "center", + top: "15", + textStyle: { + fontSize: 23 + } + }, + xAxis: { + type: 'category', + data: this.zhiNameData, + axisLabel: this.axisLabel + }, + yAxis: { + type: 'value' + }, + tooltip: { + trigger: 'item', + formatter: (params)=>{ + return this.tableTooltip(this.tableDataZhong,params.name) + }, + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0' + }, + series: [{ + data: this.zhiNumData, + type: 'bar', + showBackground: true, + backgroundStyle: { + color: 'rgba(220, 220, 220, 0.8)' + }, + barWidth :'28', + label: this.topTextlabel + }] + }; + addEchart.setOption(option); + addEchart.on('click', (params) => { + this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_typeDetails'],{queryParams:{'organizationName':params.name,'buildingTypeName':item.name}}) + }); + }) + + } + //提示框表格 + tableTooltip(dataArr,title:string){ + let data = dataArr + var res = '
'+title+'
' + res+='
'; + res+=''; + res+=''; + res+='' + res+='' + res+='' + res+=''; + for(var i=0;i' + res+='' + res+='' + } + + res+='' + res+='' + res+='
名称数量总占比
'+data[i].number+''+data[i].zhanbi+'
总计135619%
' + return res + } + +} diff --git a/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.html b/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.html index a6a2a6b..b560d1b 100644 --- a/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.html +++ b/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.html @@ -1 +1,4 @@ -

building-type-one works!

+ + +
+ \ No newline at end of file diff --git a/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.scss b/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.scss index e69de29..1bffad0 100644 --- a/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.scss +++ b/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.scss @@ -0,0 +1,8 @@ +.tishi{ + width: 100%; + height: 100%; + span{ + font-size: 25px; + text-align: center; + } +} \ No newline at end of file diff --git a/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.ts b/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.ts index b475080..867d366 100644 --- a/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.ts +++ b/src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; - +import { Router } from '@angular/router'; +declare var echarts: any; @Component({ selector: 'app-building-type-one', templateUrl: './building-type-one.component.html', @@ -7,9 +8,117 @@ import { Component, OnInit } from '@angular/core'; }) export class BuildingTypeOneComponent implements OnInit { - constructor() { } + constructor(private router: Router) { } ngOnInit(): void { + window.setTimeout(()=>{ + this.initCharts() + },0) + } + /* 首页饼状图 */ + initCharts(){ + let indexBzt = echarts.init(document.getElementById('indexBzt')); + let options={ + title: { + text: '建筑类型统计(8900家)', + left: 'center', + top: "7%", + textStyle: { + fontSize:31 + } + }, + tooltip: { + trigger: 'item', + formatter: (params)=>{ + return this.biaogeTishi(params.name) + }, + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0' + }, + legend: { + orient: 'vertical', + right: 150, + top:80, + data: ['高层', '地下', '轨道交通', '化工生产', '储罐类' , '厂房','古建筑', '商市场', '医院', '学校', '宾馆' , '娱乐场所','餐饮业', '影剧院', '展览建筑' , '隧道'] + }, + series: [ + { + name: '访问来源', + type: 'pie', + radius: '60%', + center: ['50%', '53%'], + label:{ + show:true, + fontSize:13, + formatter:'{b}{c}家\n{d|({d}%)}', + rich: { + d: { + align: 'center', + } + }, + }, + data: [ + {value: 500, name: '高层'}, + {value: 800, name: '地下'}, + {value: 900, name: '轨道交通'}, + {value: 800, name: '化工生产'}, + {value: 1200, name: '储罐类'}, + {value: 1500, name: '厂房'}, + {value: 1400, name: '古建筑'}, + {value: 600, name: '商市场'}, + {value: 568, name: '医院'}, + {value: 888, name: '学校'}, + {value: 485, name: '宾馆'}, + {value: 966, name: '娱乐场所'}, + {value: 789, name: '餐饮业'}, + {value: 500, name: '影剧院'}, + {value: 1025, name: '展览建筑'}, + {value: 600, name: '隧道'} + ], + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + } + } + ] + }; + indexBzt.on('click', (params) => { + this.router.navigateByUrl('/statisticanalysis/buildingType_one/buildingType_two_forward'); + }); + indexBzt.setOption(options); + } + biaogeTishi(biaotou:string){ + var shuju='[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄埔支队","number":"144","zhanbi":"2.8%"},' + shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' + shuju+='{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},' + shuju+='{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},' + shuju+='{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},' + shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' + shuju+='{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},' + shuju+='{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]' + var jsonObj = JSON.parse(shuju); + var res = '
'+biaotou+'
' + res+='
'; + res+=''; + res+=''; + res+='' + res+='' + res+='' + res+=''; + for(var i=0;i' + res+='' + res+='' + } + + res+='' + res+='' + res+='
名称数量总占比
'+jsonObj[i].number+''+jsonObj[i].zhanbi+'
总计135619%
' + return res } - } diff --git a/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.html b/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.html new file mode 100644 index 0000000..14f2882 --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.html @@ -0,0 +1,13 @@ +
+
+
+ + +
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.scss b/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.scss new file mode 100644 index 0000000..98f42c4 --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.scss @@ -0,0 +1,38 @@ +.box{ + width: 100%; + height: 92%; + display: flex; + flex-direction: column; + overflow: hidden; + position: relative; + .topbox{ + width: 100%; + height: 80px; + border-bottom: 1px gray solid; + .btnbox{ + display: flex; + flex-direction:column; + float: right; + justify-content: space-around; + height: 100%; + button{ + width: 88px; + height: 36px; + } + margin-right:4%; + } + } + .echartsbox{ + width: 100%; + height: 100%; + overflow: auto; + #barEchart{ + width: 100%; + height: 350px; + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%,-50%); + } + } +} \ No newline at end of file diff --git a/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.spec.ts b/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.spec.ts new file mode 100644 index 0000000..93f7f44 --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BuildingTypeThreeDetailsComponent } from './building-type-three-details.component'; + +describe('BuildingTypeThreeDetailsComponent', () => { + let component: BuildingTypeThreeDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ BuildingTypeThreeDetailsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(BuildingTypeThreeDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.ts b/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.ts new file mode 100644 index 0000000..e180a13 --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.ts @@ -0,0 +1,110 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; +declare var echarts: any; +@Component({ + selector: 'app-building-type-three-details', + templateUrl: './building-type-three-details.component.html', + styleUrls: ['./building-type-three-details.component.scss'] +}) +export class BuildingTypeThreeDetailsComponent implements OnInit { + + constructor(public route: ActivatedRoute,private router: Router) { } + forward(){ + this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_forward']) + } + reverse(){ + this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_reverse']) + } + + organizationName:String + buildingTypeName:String + + ngOnInit(): void { + this.route.queryParams.subscribe(params => { + this.organizationName = params['organizationName']; + this.buildingTypeName = params['buildingTypeName']; + }); + window.setTimeout(()=>{ + this.detailEcharts() + }) + } + topTextlabel = { + show: true, // 开启显示 + position: 'top', // 在上方显示 + distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 + verticalAlign: 'middle', + textStyle: { // 数值样式 + color: 'black', + fontSize: 12 + } + }//柱状图数值顶部显示 + zhongNameData = ["浦东中队","黄埔中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"] + zhongNumData = [200,190,180,170,160,150,140,130,120,110,100] + detailEcharts(){ + var detailPlanEchart = echarts.init(document.getElementById('barEchart')); + var option = { + title: { + text: this.buildingTypeName + '(' +this.organizationName + ')', + left: "center", + textStyle: { + fontSize: 28 + } + }, + xAxis: { + type: 'category', + data: this.zhongNameData, + // axisLabel: this.axisLabel + }, + yAxis: { + type: 'value' + }, + tooltip: { + trigger: 'item', + formatter: (params)=>{ + return this.tableTooltip(params) + }, + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0' + }, + series: [{ + data: this.zhongNumData, + type: 'bar', + showBackground: true, + barWidth :'58', + backgroundStyle: { + color: 'rgba(220, 220, 220, 0.8)' + }, + label: this.topTextlabel + }] + }; + detailPlanEchart.setOption(option); + } + + + tableTooltip(params:any){ + var data = [ + {name:params.name,number:params.value,zhanbi:(params.value/1340 * 100).toFixed(2) + "%"} + ] + var res = '
'+params.name+'
' + res+='
'; + res+=''; + res+=''; + res+='' + res+='' + res+='' + res+=''; + for(var i=0;i' + res+='' + res+='' + } + + res+='' + // res+='' + res+='
名称数量总占比
'+data[i].number+''+data[i].zhanbi+'
总计135619%
' + return res + } +} diff --git a/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.html b/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.html new file mode 100644 index 0000000..ab41180 --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.html @@ -0,0 +1,31 @@ +
+
+
+ + +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
diff --git a/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.scss b/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.scss new file mode 100644 index 0000000..6eac21d --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.scss @@ -0,0 +1,41 @@ +.box{ + width: 100%; + height: 92%; + display: flex; + flex-direction: column; + overflow: hidden; + position: relative; + .topbox{ + width: 100%; + height: 80px; + border-bottom: 1px gray solid; + .btnbox{ + display: flex; + flex-direction:column; + float: right; + justify-content: space-around; + height: 100%; + button{ + width: 88px; + height: 36px; + } + margin-right:4%; + } + } + .echartsbox{ + width: 100%; + height: 100%; + overflow: auto; + } + #pie{ + width: 100%; + height: 450px; + } +} +.publicCss{ + height: 350px; + width: 50%; + display: inline-block; + box-sizing: border-box; + padding: 20px; +} diff --git a/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.spec.ts b/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.spec.ts new file mode 100644 index 0000000..f09fbfd --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BuildingTypeTwoForwardComponent } from './building-type-two-forward.component'; + +describe('BuildingTypeTwoForwardComponent', () => { + let component: BuildingTypeTwoForwardComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ BuildingTypeTwoForwardComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(BuildingTypeTwoForwardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.ts b/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.ts new file mode 100644 index 0000000..aaed0aa --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.ts @@ -0,0 +1,298 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +declare var echarts: any; +@Component({ + selector: 'app-building-type-two-forward', + templateUrl: './building-type-two-forward.component.html', + styleUrls: ['./building-type-two-forward.component.scss'] +}) +export class BuildingTypeTwoForwardComponent implements OnInit { + + constructor(private router: Router) { } + forward(){ + this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_forward']) + } + reverse(){ + this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_reverse']) + } + ngOnInit(): void { + window.setTimeout(()=>{ + this.initCharts() + this.barEcharts() + },0) + } + axisLabel = { + interval: 0, + formatter:function(value) + { + var ret = "";//拼接加\n返回的类目项 + var maxLength = 2;//每项显示文字个数 + var valLength = value.length;//X轴类目项的文字个数 + var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数 + if (rowN > 1)//如果类目项的文字大于3, + { + for (var i = 0; i < rowN; i++) { + var temp = "";//每次截取的字符串 + var start = i * maxLength;//开始截取的位置 + var end = start + maxLength;//结束截取的位置 + //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧 + temp = value.substring(start, end) + "\n"; + ret += temp; //凭借最终的字符串 + } + return ret; + } + else { + return value; + } + } + }//echarts两个字换行 + + topTextlabel = { + show: true, // 开启显示 + position: 'top', // 在上方显示 + distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 + verticalAlign: 'middle', + textStyle: { // 数值样式 + color: 'black', + fontSize: 12 + } + }//柱状图数值顶部显示 + + tableDataZhi = [ {name:"浦东支队",number:"156",zhanbi:"3%"}, + {name:"黄埔支队",number:"144",zhanbi:"2.8%"}, + {name:"徐汇支队",number:"133",zhanbi:"2.1%"}, + {name:"长宁支队",number:"122",zhanbi:"1.6%"}, + {name:"静安支队",number:"120",zhanbi:"1.3%"}, + {name:"普陀支队",number:"100",zhanbi:"1.1%"}, + {name:"虹口支队",number:"95",zhanbi:"1%"}, + {name:"杨浦支队",number:"90",zhanbi:"0.9%"}, + {name:"闵行支队",number:"88",zhanbi:"0.8%"}, + {name:"宝山支队",number:"83",zhanbi:"0.7%"}, + {name:"徐汇支队",number:"133",zhanbi:"2.1%"}, + {name:"长宁支队",number:"122",zhanbi:"1.6%"}, + {name:"嘉定支队",number:"78",zhanbi:"0.6%"}, + {name:"松江支队",number:"75",zhanbi:"0.5%"}, + {name:"金山支队",number:"65",zhanbi:"0.4%"}, + {name:"崇明支队",number:"55",zhanbi:"0.3%"} ] + tableDataZhong = [ {name:"浦东中队",number:"156",zhanbi:"3%"}, + {name:"黄埔中队",number:"144",zhanbi:"2.8%"}, + {name:"徐汇中队",number:"133",zhanbi:"2.1%"}, + {name:"长宁中队",number:"122",zhanbi:"1.6%"}, + {name:"静安中队",number:"120",zhanbi:"1.3%"}, + {name:"普陀中队",number:"100",zhanbi:"1.1%"}, + {name:"虹口中队",number:"95",zhanbi:"1%"}, + {name:"杨浦中队",number:"90",zhanbi:"0.9%"}, + {name:"闵行中队",number:"88",zhanbi:"0.8%"}, + {name:"宝山中队",number:"83",zhanbi:"0.7%"}, + {name:"徐汇中队",number:"133",zhanbi:"2.1%"}, + {name:"长宁中队",number:"122",zhanbi:"1.6%"}, + {name:"嘉定中队",number:"78",zhanbi:"0.6%"}, + {name:"松江中队",number:"75",zhanbi:"0.5%"}, + {name:"金山中队",number:"65",zhanbi:"0.4%"}, + {name:"崇明中队",number:"55",zhanbi:"0.3%"} ] + zhiNameData = ["浦东支队","黄埔支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队",'青浦支队'] + zhiNumData = [200,190,180,170,160,150,140,130,120,110,100,90,80,70,60] + pieData = [ + {value: 500, name: '浦东支队'}, + {value: 800, name: '黄埔支队'}, + {value: 900, name: '徐汇支队'}, + {value: 800, name: '长宁支队'}, + {value: 1200, name: '静安支队'}, + {value: 1500, name: '普陀支队'}, + {value: 1400, name: '虹口支队'}, + {value: 600, name: '杨浦支队'}, + {value: 568, name: '闵行支队'}, + {value: 888, name: '宝山支队'}, + {value: 485, name: '嘉定支队'}, + {value: 966, name: '松江支队'}, + {value: 789, name: '金山支队'}, + {value: 500, name: '崇明支队'}, + {value: 1025, name: '展览建筑'}, + {value: 600, name: '青浦支队'} + ] + buildingTypeName = ['高层','地下','轨道交通','化工生产','储罐类','厂房','古建筑','商市场','医院','学校','宾馆','娱乐场所','餐饮业','影剧院','展览建筑','隧道'] + buildingTypeNum = [200,190,180,170,160,150,140,130,120,110,100,90,80,70,60,50] + forArr = [{id:'gaoceng',name:'浦东支队'}, + {id:'dixia',name:'黄埔支队'}, + {id:'guidao',name:'徐汇支队'}, + {id:'huagong',name:'长宁支队'}, + {id:'chuguan',name:'静安支队'}, + {id:'changfang',name:'普陀支队'}, + {id:'gujianzhu',name:'虹口支队'}, + {id:'shichang',name:'杨浦支队'}, + {id:'yiyuan',name:'闵行支队'}, + {id:'xuexiao',name:'宝山支队'}, + {id:'binguan',name:'嘉定支队'}, + {id:'yule',name:'松江支队'}, + {id:'canyin',name:'金山支队'}, + {id:'yingyuan',name:'崇明支队'}, + {id:'zhanlan',name:'青浦支队'}, + ] + + /* 顶部饼状图 */ + initCharts(){ + let indexBzt = echarts.init(document.getElementById('pie')); + let options={ + title: { + text: '组织机构统计(5500家)', + left: 'center', + top: "7%", + textStyle: { + fontSize:26 + } + }, + tooltip: { + trigger: 'item', + formatter: (params)=>{ + return this.tableTooltip(this.tableDataZhi,params.name) + }, + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0', + position: function (point, params, dom, rect, size) { + // 鼠标坐标和提示框位置的参考坐标系是:以外层div的左上角那一点为原点,x轴向右,y轴向下 + // 提示框位置 + var x = 0; // x坐标位置 + var y = 0; // y坐标位置 + + // 当前鼠标位置 + var pointX = point[0]; + var pointY = point[1]; + + // 外层div大小 + // var viewWidth = size.viewSize[0]; + // var viewHeight = size.viewSize[1]; + + // 提示框大小 + var boxWidth = size.contentSize[0]; + var boxHeight = size.contentSize[1]; + + // boxWidth > pointX 说明鼠标左边放不下提示框 + if (boxWidth > pointX) { + x = 35; + } else { // 左边放的下 + x = pointX + 80; + } + + // boxHeight > pointY 说明鼠标上边放不下提示框 + if (boxHeight > pointY) { + y = 65; + } else { // 上边放得下 + y = pointY - boxHeight; + } + + return [pointX, pointY]; + } + }, + legend: { + orient: 'vertical', + right: 150, + top:80, + data:this.zhiNameData + }, + series: [ + { + name: '访问来源', + type: 'pie', + radius: '60%', + center: ['50%', '60%'], + label:{ + show:true, + fontSize:13, + formatter:'{b}{c}家\n{d|({d}%)}', + rich: { + d: { + align: 'center', + } + }, + }, + data: this.pieData, + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + } + } + ] + }; + indexBzt.on('click', (params) => { + // this.router.navigateByUrl('/statisticanalysis/buildingType_two_forward'); + }); + indexBzt.setOption(options); + } + //柱状图 + barEcharts(){ + this.forArr.forEach(item=>{ + let _this = this + let Echart = echarts.init(document.getElementById(item.id)); + let option = { + color: ['#3398DB'], + title: { + text: item.name, + left: "center", + top: "15", + textStyle: { + fontSize: 23 + } + }, + xAxis: { + type: 'category', + data: this.buildingTypeName, + axisLabel: this.axisLabel + }, + yAxis: { + type: 'value' + }, + tooltip: { + trigger: 'item', + formatter: (params)=>{ + return this.tableTooltip(this.tableDataZhong,params.name) + }, + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0' + }, + series: [{ + data: this.buildingTypeNum, + type: 'bar', + showBackground: true, + backgroundStyle: { + color: 'rgba(220, 220, 220, 0.8)' + }, + barWidth :'28', + label: this.topTextlabel + }] + }; + Echart.setOption(option); + Echart.on('click', (params) => { + this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_three_details'],{queryParams:{'organizationName':item.name,'buildingTypeName':params.name}}) + }); + }) + + } + //提示框表格 + tableTooltip(dataArr,title:string){ + let data = dataArr + var res = '
'+title+'
' + res+='
'; + res+=''; + res+=''; + res+='' + res+='' + res+='' + res+=''; + for(var i=0;i' + res+='' + res+='' + } + + res+='' + res+='' + res+='
名称数量总占比
'+data[i].number+''+data[i].zhanbi+'
总计135619%
' + return res + } +} diff --git a/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.html b/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.html new file mode 100644 index 0000000..bdb66e9 --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.html @@ -0,0 +1,32 @@ +
+
+
+ + +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.scss b/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.scss new file mode 100644 index 0000000..339f54b --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.scss @@ -0,0 +1,41 @@ +.box{ + width: 100%; + height: 92%; + display: flex; + flex-direction: column; + overflow: hidden; + position: relative; + .topbox{ + width: 100%; + height: 80px; + border-bottom: 1px gray solid; + .btnbox{ + display: flex; + flex-direction:column; + float: right; + justify-content: space-around; + height: 100%; + button{ + width: 88px; + height: 36px; + } + margin-right:4%; + } + } + .echartsbox{ + width: 100%; + height: 100%; + overflow: auto; + } + #pie{ + width: 100%; + height: 450px; + } +} +.publicCss{ + height: 350px; + width: 50%; + display: inline-block; + box-sizing: border-box; + padding: 20px; +} \ No newline at end of file diff --git a/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.spec.ts b/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.spec.ts new file mode 100644 index 0000000..5e3f000 --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BuildingTypeTwoReverseComponent } from './building-type-two-reverse.component'; + +describe('BuildingTypeTwoReverseComponent', () => { + let component: BuildingTypeTwoReverseComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ BuildingTypeTwoReverseComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(BuildingTypeTwoReverseComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.ts b/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.ts new file mode 100644 index 0000000..22efeb3 --- /dev/null +++ b/src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.ts @@ -0,0 +1,296 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +declare var echarts: any; +@Component({ + selector: 'app-building-type-two-reverse', + templateUrl: './building-type-two-reverse.component.html', + styleUrls: ['./building-type-two-reverse.component.scss'] +}) +export class BuildingTypeTwoReverseComponent implements OnInit { + + constructor(private router: Router) { } + + forward(){ + this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_forward']) + } + reverse(){ + this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_reverse']) + } + ngOnInit(): void { + window.setTimeout(()=>{ + this.initCharts() + this.barEcharts() + },0) + } + + axisLabel = { + interval: 0, + formatter:function(value) + { + var ret = "";//拼接加\n返回的类目项 + var maxLength = 2;//每项显示文字个数 + var valLength = value.length;//X轴类目项的文字个数 + var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数 + if (rowN > 1)//如果类目项的文字大于3, + { + for (var i = 0; i < rowN; i++) { + var temp = "";//每次截取的字符串 + var start = i * maxLength;//开始截取的位置 + var end = start + maxLength;//结束截取的位置 + //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧 + temp = value.substring(start, end) + "\n"; + ret += temp; //凭借最终的字符串 + } + return ret; + } + else { + return value; + } + } + }//echarts两个字换行 + + topTextlabel = { + show: true, // 开启显示 + position: 'top', // 在上方显示 + distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 + verticalAlign: 'middle', + textStyle: { // 数值样式 + color: 'black', + fontSize: 12 + } + }//柱状图数值顶部显示 + + tableDataZhi = [ {name:"浦东支队",number:"156",zhanbi:"3%"}, + {name:"黄埔支队",number:"144",zhanbi:"2.8%"}, + {name:"徐汇支队",number:"133",zhanbi:"2.1%"}, + {name:"长宁支队",number:"122",zhanbi:"1.6%"}, + {name:"静安支队",number:"120",zhanbi:"1.3%"}, + {name:"普陀支队",number:"100",zhanbi:"1.1%"}, + {name:"虹口支队",number:"95",zhanbi:"1%"}, + {name:"杨浦支队",number:"90",zhanbi:"0.9%"}, + {name:"闵行支队",number:"88",zhanbi:"0.8%"}, + {name:"宝山支队",number:"83",zhanbi:"0.7%"}, + {name:"徐汇支队",number:"133",zhanbi:"2.1%"}, + {name:"长宁支队",number:"122",zhanbi:"1.6%"}, + {name:"嘉定支队",number:"78",zhanbi:"0.6%"}, + {name:"松江支队",number:"75",zhanbi:"0.5%"}, + {name:"金山支队",number:"65",zhanbi:"0.4%"}, + {name:"崇明支队",number:"55",zhanbi:"0.3%"} ] + tableDataZhong = [ {name:"浦东中队",number:"156",zhanbi:"3%"}, + {name:"黄埔中队",number:"144",zhanbi:"2.8%"}, + {name:"徐汇中队",number:"133",zhanbi:"2.1%"}, + {name:"长宁中队",number:"122",zhanbi:"1.6%"}, + {name:"静安中队",number:"120",zhanbi:"1.3%"}, + {name:"普陀中队",number:"100",zhanbi:"1.1%"}, + {name:"虹口中队",number:"95",zhanbi:"1%"}, + {name:"杨浦中队",number:"90",zhanbi:"0.9%"}, + {name:"闵行中队",number:"88",zhanbi:"0.8%"}, + {name:"宝山中队",number:"83",zhanbi:"0.7%"}, + {name:"徐汇中队",number:"133",zhanbi:"2.1%"}, + {name:"长宁中队",number:"122",zhanbi:"1.6%"}, + {name:"嘉定中队",number:"78",zhanbi:"0.6%"}, + {name:"松江中队",number:"75",zhanbi:"0.5%"}, + {name:"金山中队",number:"65",zhanbi:"0.4%"}, + {name:"崇明中队",number:"55",zhanbi:"0.3%"} ] + zhiNameData = ["浦东支队","黄埔支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"] + zhiNumData = [200,190,180,170,160,150,140,130,120,110,100,90,80,70] + forArr = [{id:'gaoceng',name:'高层'}, + {id:'dixia',name:'地下'}, + {id:'guidao',name:'轨道交通'}, + {id:'huagong',name:'化工生产'}, + {id:'chuguan',name:'储罐类'}, + {id:'changfang',name:'厂房'}, + {id:'gujianzhu',name:'古建筑'}, + {id:'shichang',name:'商市场'}, + {id:'yiyuan',name:'医院'}, + {id:'xuexiao',name:'学校'}, + {id:'binguan',name:'宾馆'}, + {id:'yule',name:'娱乐场所'}, + {id:'canyin',name:'餐饮业'}, + {id:'yingyuan',name:'影剧院'}, + {id:'zhanlan',name:'展览建筑'}, + {id:'suidao',name:'隧道'}] + + /* 顶部饼状图 */ + initCharts(){ + let indexBzt = echarts.init(document.getElementById('pie')); + let options={ + title: { + text: '建筑类型统计(8900家)', + left: 'center', + top: "7%", + textStyle: { + fontSize:26 + } + }, + tooltip: { + trigger: 'item', + formatter: (params)=>{ + return this.tableTooltip(this.tableDataZhi,params.name) + }, + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0', + position: function (point, params, dom, rect, size) { + // 鼠标坐标和提示框位置的参考坐标系是:以外层div的左上角那一点为原点,x轴向右,y轴向下 + // 提示框位置 + var x = 0; // x坐标位置 + var y = 0; // y坐标位置 + + // 当前鼠标位置 + var pointX = point[0]; + var pointY = point[1]; + + // 外层div大小 + // var viewWidth = size.viewSize[0]; + // var viewHeight = size.viewSize[1]; + + // 提示框大小 + var boxWidth = size.contentSize[0]; + var boxHeight = size.contentSize[1]; + + // boxWidth > pointX 说明鼠标左边放不下提示框 + if (boxWidth > pointX) { + x = 35; + } else { // 左边放的下 + x = pointX + 80; + } + + // boxHeight > pointY 说明鼠标上边放不下提示框 + if (boxHeight > pointY) { + y = 65; + } else { // 上边放得下 + y = pointY - boxHeight; + } + + return [pointX, pointY]; + } + }, + legend: { + orient: 'vertical', + right: 150, + top:80, + data: ['高层', '地下', '轨道交通', '化工生产', '储罐类' , '厂房','古建筑', '商市场', '医院', '学校', '宾馆' , '娱乐场所','餐饮业', '影剧院', '展览建筑' , '隧道'] + }, + series: [ + { + name: '访问来源', + type: 'pie', + radius: '60%', + center: ['50%', '60%'], + label:{ + show:true, + fontSize:13, + formatter:'{b}{c}家\n{d|({d}%)}', + rich: { + d: { + align: 'center', + } + }, + }, + data: [ + {value: 500, name: '高层'}, + {value: 800, name: '地下'}, + {value: 900, name: '轨道交通'}, + {value: 800, name: '化工生产'}, + {value: 1200, name: '储罐类'}, + {value: 1500, name: '厂房'}, + {value: 1400, name: '古建筑'}, + {value: 600, name: '商市场'}, + {value: 568, name: '医院'}, + {value: 888, name: '学校'}, + {value: 485, name: '宾馆'}, + {value: 966, name: '娱乐场所'}, + {value: 789, name: '餐饮业'}, + {value: 500, name: '影剧院'}, + {value: 1025, name: '展览建筑'}, + {value: 600, name: '隧道'} + ], + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + } + } + ] + }; + indexBzt.on('click', (params) => { + // this.router.navigateByUrl('/statisticanalysis/buildingType_two_forward'); + }); + indexBzt.setOption(options); + } + //柱状图 + barEcharts(){ + this.forArr.forEach(item=>{ + let _this = this + let addEchart = echarts.init(document.getElementById(item.id)); + let option = { + title: { + text: item.name, + left: "center", + top: "15", + textStyle: { + fontSize: 23 + } + }, + xAxis: { + type: 'category', + data: this.zhiNameData, + axisLabel: this.axisLabel + }, + yAxis: { + type: 'value' + }, + tooltip: { + trigger: 'item', + formatter: (params)=>{ + return this.tableTooltip(this.tableDataZhong,params.name) + }, + backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + borderWidth:'1', + borderRadius :'0' + }, + series: [{ + data: this.zhiNumData, + type: 'bar', + showBackground: true, + backgroundStyle: { + color: 'rgba(220, 220, 220, 0.8)' + }, + barWidth :'28', + label: this.topTextlabel + }] + }; + addEchart.setOption(option); + addEchart.on('click', (params) => { + this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_three_details'],{queryParams:{'organizationName':params.name,'buildingTypeName':item.name}}) + }); + }) + + } + //提示框表格 + tableTooltip(dataArr,title:string){ + let data = dataArr + var res = '
'+title+'
' + res+='
'; + res+=''; + res+=''; + res+='' + res+='' + res+='' + res+=''; + for(var i=0;i' + res+='' + res+='' + } + + res+='' + res+='' + res+='
名称数量总占比
'+data[i].number+''+data[i].zhanbi+'
总计135619%
' + return res + } +} diff --git a/src/app/statistic-analysis/echarts-data.service.ts b/src/app/statistic-analysis/echarts-data.service.ts index b6a0ca3..d56c4c1 100644 --- a/src/app/statistic-analysis/echarts-data.service.ts +++ b/src/app/statistic-analysis/echarts-data.service.ts @@ -12,5 +12,134 @@ export class EchartsDataService { statefulInspectionToggle:boolean = true; // true=显示所有柱状图 flase=显示当前点击柱状图 + //支队提示框 + tableDataZhi = [ + {name:"浦东支队",number:"156",zhanbi:"3%"}, + {name:"黄埔支队",number:"144",zhanbi:"2.8%"}, + {name:"徐汇支队",number:"133",zhanbi:"2.1%"}, + {name:"长宁支队",number:"122",zhanbi:"1.6%"}, + {name:"静安支队",number:"120",zhanbi:"1.3%"}, + {name:"普陀支队",number:"100",zhanbi:"1.1%"}, + {name:"虹口支队",number:"95",zhanbi:"1%"}, + {name:"杨浦支队",number:"90",zhanbi:"0.9%"}, + {name:"闵行支队",number:"88",zhanbi:"0.8%"}, + {name:"宝山支队",number:"83",zhanbi:"0.7%"}, + {name:"徐汇支队",number:"133",zhanbi:"2.1%"}, + {name:"长宁支队",number:"122",zhanbi:"1.6%"}, + {name:"嘉定支队",number:"78",zhanbi:"0.6%"}, + {name:"松江支队",number:"75",zhanbi:"0.5%"}, + {name:"金山支队",number:"65",zhanbi:"0.4%"}, + {name:"崇明支队",number:"55",zhanbi:"0.3%"} + ] + //中队提示框 + tableDataZhong = [ + {name:"浦东中队",number:"156",zhanbi:"3%"}, + {name:"黄埔中队",number:"144",zhanbi:"2.8%"}, + {name:"徐汇中队",number:"133",zhanbi:"2.1%"}, + {name:"长宁中队",number:"122",zhanbi:"1.6%"}, + {name:"静安中队",number:"120",zhanbi:"1.3%"}, + {name:"普陀中队",number:"100",zhanbi:"1.1%"}, + {name:"虹口中队",number:"95",zhanbi:"1%"}, + {name:"杨浦中队",number:"90",zhanbi:"0.9%"}, + {name:"闵行中队",number:"88",zhanbi:"0.8%"}, + {name:"宝山中队",number:"83",zhanbi:"0.7%"}, + {name:"徐汇中队",number:"133",zhanbi:"2.1%"}, + {name:"长宁中队",number:"122",zhanbi:"1.6%"}, + {name:"嘉定中队",number:"78",zhanbi:"0.6%"}, + {name:"松江中队",number:"75",zhanbi:"0.5%"}, + {name:"金山中队",number:"65",zhanbi:"0.4%"}, + {name:"崇明中队",number:"55",zhanbi:"0.3%"} + ] + //建筑类型提示框 + buildingType = [ + {name:"高层",number:"156",zhanbi:"3%"}, + {name:"地下",number:"144",zhanbi:"2.8%"}, + {name:"轨道交通",number:"133",zhanbi:"2.1%"}, + {name:"化工生产",number:"122",zhanbi:"1.6%"}, + {name:"储罐类",number:"120",zhanbi:"1.3%"}, + {name:"厂房",number:"100",zhanbi:"1.1%"}, + {name:"古建筑",number:"95",zhanbi:"1%"}, + {name:"商市场",number:"90",zhanbi:"0.9%"}, + {name:"医院",number:"88",zhanbi:"0.8%"}, + {name:"学校",number:"83",zhanbi:"0.7%"}, + {name:"宾馆",number:"133",zhanbi:"2.1%"}, + {name:"娱乐场所",number:"122",zhanbi:"1.6%"}, + {name:"餐饮业",number:"78",zhanbi:"0.6%"}, + {name:"影剧院",number:"75",zhanbi:"0.5%"}, + {name:"展览建筑",number:"65",zhanbi:"0.4%"}, + {name:"隧道",number:"55",zhanbi:"0.3%"} + ] + //提示框表格 + tableTooltip(dataArr,title:string){ + let data = dataArr + var res = '
'+title+'
' + res+='
'; + res+=''; + res+=''; + res+='' + res+='' + res+='' + res+=''; + for(var i=0;i' + res+='' + res+='' + } + + res+='' + res+='' + res+='
名称数量总占比
'+data[i].number+''+data[i].zhanbi+'
总计135619%
' + return res + } + //如果提示框显示不开 + tableTooltipNoShow(point, params, dom, rect, size) { + // 鼠标坐标和提示框位置的参考坐标系是:以外层div的左上角那一点为原点,x轴向右,y轴向下 + // 提示框位置 + var x = 0; // x坐标位置 + var y = 0; // y坐标位置 + + // 当前鼠标位置 + var pointX = point[0]; + var pointY = point[1]; + + // 外层div大小 + // var viewWidth = size.viewSize[0]; + // var viewHeight = size.viewSize[1]; + + // 提示框大小 + var boxWidth = size.contentSize[0]; + var boxHeight = size.contentSize[1]; + + // boxWidth > pointX 说明鼠标左边放不下提示框 + if (boxWidth > pointX) { + x = 35; + } else { // 左边放的下 + x = pointX + 80; + } + + // boxHeight > pointY 说明鼠标上边放不下提示框 + if (boxHeight > pointY) { + y = 65; + } else { // 上边放得下 + y = pointY - boxHeight; + } + + return [pointX, pointY]; + } + + + //用法: + + // tooltip: { + // trigger: 'axis', + // backgroundColor:'rgba(255,255,255,1)',//通过设置rgba调节背景颜色与透明度 + // borderWidth:'1', + // borderRadius :'0', + // formatter: (params)=>{ + // return this.serviceData.tableTooltip(this.serviceData.buildingType,params[0].name) + // }, + // position:this.serviceData.tableTooltipNoShow + // } } diff --git a/src/app/statistic-analysis/state/page-one/page-one.component.scss b/src/app/statistic-analysis/state/page-one/page-one.component.scss index 8ff7710..1bffad0 100644 --- a/src/app/statistic-analysis/state/page-one/page-one.component.scss +++ b/src/app/statistic-analysis/state/page-one/page-one.component.scss @@ -4,5 +4,5 @@ span{ font-size: 25px; text-align: center; -} + } } \ No newline at end of file diff --git a/src/app/statistic-analysis/state/page-one/page-one.component.ts b/src/app/statistic-analysis/state/page-one/page-one.component.ts index 1563f44..edbe514 100644 --- a/src/app/statistic-analysis/state/page-one/page-one.component.ts +++ b/src/app/statistic-analysis/state/page-one/page-one.component.ts @@ -19,7 +19,6 @@ declare var echarts: any; export class PageOneComponent implements OnInit { options:any; - constructor(private router: Router) { } ngOnInit() { @@ -103,7 +102,7 @@ export class PageOneComponent implements OnInit { indexBzt.on('click', (params) => { this.router.navigateByUrl('/statisticanalysis/statePageTwo_time'); }); - indexBzt.setOption(options); + indexBzt.setOption(options); } /** * @name: 表格提示框封装 diff --git a/src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts b/src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts index 646b135..ac56a0b 100644 --- a/src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts +++ b/src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts @@ -307,8 +307,6 @@ export class PageTwoNameComponent implements OnInit { //预案状态统计 planState(){ - var shuju='[{"name":"浦东支队","number":"23","zhanbi":"21%"},{"name":"浦东支队","number":"23","zhanbi":"21%"},{"name":"浦东支队","number":"23","zhanbi":"21%"},{"name":"浦东支队","number":"23","zhanbi":"21%"},{"name":"浦东支队","number":"23","zhanbi":"21%"}]'; - var jsonObj = JSON.parse(shuju); var passPlanEchart = echarts.init(document.getElementById('pie')); var option = { title: { diff --git a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.scss b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.scss index 5984003..ce92b6e 100644 --- a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.scss +++ b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.scss @@ -12,7 +12,7 @@ .center { width: 100%; height: 100%; - overflow: auto;; + overflow: auto; } } } diff --git a/src/app/statistic-analysis/statistic-analysis-routing.module.ts b/src/app/statistic-analysis/statistic-analysis-routing.module.ts index 1bbcbfb..acd3c20 100644 --- a/src/app/statistic-analysis/statistic-analysis-routing.module.ts +++ b/src/app/statistic-analysis/statistic-analysis-routing.module.ts @@ -9,6 +9,13 @@ import { DeleteTwoComponent } from './deleteUnit/delete-two/delete-two.component import { DeleteThereComponent } from './deleteUnit/delete-there/delete-there.component'; import { DeleteFourComponent } from './deleteUnit/delete-four/delete-four.component'; import { BuildingTypeOneComponent } from './buildingType/building-type-one/building-type-one.component'; +import { BuildingTypeTwoForwardComponent } from './buildingType/building-type-two-forward/building-type-two-forward.component'; +import { BuildingTypeTwoReverseComponent } from './buildingType/building-type-two-reverse/building-type-two-reverse.component'; +import { BuildingTypeThreeDetailsComponent } from './buildingType/building-type-three-details/building-type-three-details.component'; +import { AddUnitOneComponent } from './addUnit/add-unit-one/add-unit-one.component'; +import { AddUnitTwoTypeStatisticsComponent } from './addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component'; +import { AddUnitTwoTypeDetailsComponent } from './addUnit/add-unit-two-type-details/add-unit-two-type-details.component'; +import { AddUnitTwoTimeComponent } from './addUnit/add-unit-two-time/add-unit-two-time.component'; const routes: Routes = [ { path: 'statePageOne', component: PageOneComponent}, @@ -17,7 +24,14 @@ const routes: Routes = [ { path: 'delete_two', component: DeleteTwoComponent}, { path: 'delete_there', component: DeleteThereComponent}, { path: 'delete_four', component: DeleteFourComponent}, - { path: 'buildingType_one', component: BuildingTypeOneComponent} + { path: 'buildingType_one', component: BuildingTypeOneComponent}, + { path: 'buildingType_one/buildingType_two_forward', component: BuildingTypeTwoForwardComponent}, + { path: 'buildingType_one/buildingType_two_reverse', component: BuildingTypeTwoReverseComponent}, + { path: 'buildingType_one/buildingType_three_details', component: BuildingTypeThreeDetailsComponent}, + { path: 'addUnit_one', component: AddUnitOneComponent}, + { path: 'addUnit_one/addUnit_two_type', component: AddUnitTwoTypeStatisticsComponent}, + { path: 'addUnit_one/addUnit_two_typeDetails', component: AddUnitTwoTypeDetailsComponent}, + { path: 'addUnit_one/addUnit_two_time', component: AddUnitTwoTimeComponent}, ]; @NgModule({ diff --git a/src/app/statistic-analysis/statistic-analysis.module.ts b/src/app/statistic-analysis/statistic-analysis.module.ts index 1b226ed..74eded9 100644 --- a/src/app/statistic-analysis/statistic-analysis.module.ts +++ b/src/app/statistic-analysis/statistic-analysis.module.ts @@ -52,10 +52,17 @@ import { DeleteTwoComponent } from './deleteUnit/delete-two/delete-two.component import { DeleteThereComponent } from './deleteUnit/delete-there/delete-there.component'; import { DeleteFourComponent } from './deleteUnit/delete-four/delete-four.component'; import { BuildingTypeOneComponent } from './buildingType/building-type-one/building-type-one.component'; +import { BuildingTypeTwoForwardComponent } from './buildingType/building-type-two-forward/building-type-two-forward.component'; +import { BuildingTypeTwoReverseComponent } from './buildingType/building-type-two-reverse/building-type-two-reverse.component'; +import { BuildingTypeThreeDetailsComponent } from './buildingType/building-type-three-details/building-type-three-details.component'; +import { AddUnitOneComponent } from './addUnit/add-unit-one/add-unit-one.component'; +import { AddUnitTwoTypeStatisticsComponent } from './addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component'; +import { AddUnitTwoTypeDetailsComponent } from './addUnit/add-unit-two-type-details/add-unit-two-type-details.component'; +import { AddUnitTwoTimeComponent } from './addUnit/add-unit-two-time/add-unit-two-time.component'; @NgModule({ - declarations: [PageOneComponent, PageTwoTimeComponent, PageTwoNameComponent, PageZhongDuiDetailsComponent,echartsComponent, DeleteOneComponent, DeleteTwoComponent, DeleteThereComponent, DeleteFourComponent, BuildingTypeOneComponent], + declarations: [PageOneComponent, PageTwoTimeComponent, PageTwoNameComponent, PageZhongDuiDetailsComponent,echartsComponent, DeleteOneComponent, DeleteTwoComponent, DeleteThereComponent, DeleteFourComponent, BuildingTypeOneComponent, BuildingTypeTwoForwardComponent, BuildingTypeTwoReverseComponent, BuildingTypeThreeDetailsComponent, AddUnitOneComponent, AddUnitTwoTypeStatisticsComponent, AddUnitTwoTypeDetailsComponent, AddUnitTwoTimeComponent], imports: [ CommonModule, StatisticAnalysisRoutingModule,