From 67ca5f4cb39c2210d70244eb9b4bdcaa4fc920c3 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Thu, 14 Apr 2022 16:19:54 +0800 Subject: [PATCH] fix bug --- .../datascreen/datascreen.component.html | 2 +- .../datascreen/datascreen.component.ts | 16 +++++++++++----- .../components/datascreen/map/map.component.ts | 13 +------------ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/app/routes/datatable/components/datascreen/datascreen.component.html b/src/app/routes/datatable/components/datascreen/datascreen.component.html index 9468c1c8..27fec9ba 100644 --- a/src/app/routes/datatable/components/datascreen/datascreen.component.html +++ b/src/app/routes/datatable/components/datascreen/datascreen.component.html @@ -93,7 +93,7 @@ - + diff --git a/src/app/routes/datatable/components/datascreen/datascreen.component.ts b/src/app/routes/datatable/components/datascreen/datascreen.component.ts index ba2a32f4..3c1448fd 100644 --- a/src/app/routes/datatable/components/datascreen/datascreen.component.ts +++ b/src/app/routes/datatable/components/datascreen/datascreen.component.ts @@ -5,7 +5,7 @@ import { map } from 'rxjs/operators'; * @Author : Shiming * @Date : 2022-04-06 10:57:56 * @LastEditors : Shiming - * @LastEditTime : 2022-04-14 14:05:01 + * @LastEditTime : 2022-04-14 16:19:06 * @FilePath : \\tms-obc-web\\src\\app\\routes\\datatable\\components\\datascreen\\datascreen.component.ts * Copyright (C) 2022 huzhenhong. All rights reserved. */ @@ -44,7 +44,7 @@ export class DatatableDatascreenComponent implements OnInit { monthData: G2TimelineData[] = []; monthData2:G2TimelineData[] =[]; - salesData2: Array = this.genData(); + salesData2: Array = []; constructor(public service: DataService) {} ngOnChanges(changes: any): void { console.log(changes); @@ -81,6 +81,7 @@ export class DatatableDatascreenComponent implements OnInit { this.service.request(this.service.$api_getAnnualTransactions).subscribe((res: any) => { this.allDeal = res; }); + this.initPillarData() this.service.request(this.service.$api_getTransactionAmount).subscribe((res: any) => { this.headDeal = res; }); @@ -105,8 +106,12 @@ export class DatatableDatascreenComponent implements OnInit { } }); } - public genData(): G2MiniAreaData[] { + genData(): any{ let value: any = []; + console.log('9999999'); + + // let value: any = [{city: '深圳市', weight: 5070.4} + // ,{city: '济宁市', weight: 338}]; this.service.request(this.service.$api_getShipmentRanking).subscribe((res: any) => { console.log(res); res.forEach((element: any) => { @@ -115,12 +120,13 @@ export class DatatableDatascreenComponent implements OnInit { y: element.weight }); }); + this.salesData2 = value }); console.log(value); - return value; } initPillarData(){ - this.curve.reRender() + // this.curve.reRender() + this.genData(); } /** * 初始化数据列表 diff --git a/src/app/routes/datatable/components/datascreen/map/map.component.ts b/src/app/routes/datatable/components/datascreen/map/map.component.ts index 739e2592..90927785 100644 --- a/src/app/routes/datatable/components/datascreen/map/map.component.ts +++ b/src/app/routes/datatable/components/datascreen/map/map.component.ts @@ -22,7 +22,7 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges, Afte constructor(private service: DataService, private ngZone: NgZone) {} ngAfterViewInit(): void { this.map.el.nativeElement.style.height = this.map.el.nativeElement.clientWidth + 'px' - this.chart.render(); + this.chart?.render(); } ngOnChanges(changes: SimpleChanges): void { @@ -35,7 +35,6 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges, Afte ngOnInit(): void {} reRender() { - console.log('5454545'); setTimeout(() => { this.chart.render(); }, 1000); @@ -75,7 +74,6 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges, Afte this.chart.legend('trend', { position: 'left' }); - console.log('8888'); // 绘制世界地图背景 this.ds = new DataSet(); @@ -99,7 +97,6 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges, Afte '订单数': element.weight, }); }); - console.log(value); this.userData = value if (!(this.userData instanceof Array) || this.userData.length === 0) { @@ -113,7 +110,6 @@ if (!(this.userData instanceof Array) || this.userData.length === 0) { }).transform({ type: 'map', callback: (obj: { trend: string; 订单数: number }) => { - console.log(obj); if(obj.订单数 < 500) { obj.trend = '500以下'; @@ -132,9 +128,6 @@ if (!(this.userData instanceof Array) || this.userData.length === 0) { alias: '订单交易数量' } }); - console.log(this.userView); - console.log('45545'); - this.userView.polygon().position('longitude*latitude').color('trend', ['#0a3f80', '#1b6aca', '#5d93d4']).tooltip('省份*订单数').style({fillOpacity: 0.85 }) .animate({ leave: { @@ -147,10 +140,6 @@ if (!(this.userData instanceof Array) || this.userData.length === 0) { } }) }); - - console.log('9999'); - - } }