diff options
4 files changed, 29 insertions, 11 deletions
diff --git a/usecaseui-portal/src/app/shared/components/charts/pie/pie.component.ts b/usecaseui-portal/src/app/shared/components/charts/pie/pie.component.ts index d22ffb02..85cf72ee 100644 --- a/usecaseui-portal/src/app/shared/components/charts/pie/pie.component.ts +++ b/usecaseui-portal/src/app/shared/components/charts/pie/pie.component.ts @@ -110,9 +110,9 @@ export class PieComponent implements OnInit { }) } - resize(size: number){ + resize(parentHeight: number, size: number){ this.chartIntance.resize( { - height: size - 250 + height: parentHeight - size }) } diff --git a/usecaseui-portal/src/app/shared/components/customer/customer.component.html b/usecaseui-portal/src/app/shared/components/customer/customer.component.html index 6de63b0f..4f532f8f 100644 --- a/usecaseui-portal/src/app/shared/components/customer/customer.component.html +++ b/usecaseui-portal/src/app/shared/components/customer/customer.component.html @@ -15,9 +15,9 @@ --> <div class="content"> <div class="chearts"> - <div class="Cu"> + <div class="Cu" #chart> <p> {{"i18nTextDefine_Instance_Count_of_Customer" | translate}} </p> - <app-pie [initData]="CUChartInit" [chartData]="CUChartData" *ngIf="serviceChart"></app-pie> + <app-pie [initData]="CUChartInit" [chartData]="CUChartData" *ngIf="serviceChart" #pie></app-pie> <div *ngIf="!serviceChart">No Service Instances </div> </div> <div class="type"> diff --git a/usecaseui-portal/src/app/shared/components/customer/customer.component.ts b/usecaseui-portal/src/app/shared/components/customer/customer.component.ts index 3fc73911..39c42a0d 100644 --- a/usecaseui-portal/src/app/shared/components/customer/customer.component.ts +++ b/usecaseui-portal/src/app/shared/components/customer/customer.component.ts @@ -13,17 +13,22 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Component, OnInit, TemplateRef } from '@angular/core'; +import { Component, OnInit, ViewChild } from '@angular/core'; import { ManagemencsService } from '../../../core/services/managemencs.service'; import { NzNotificationService } from 'ng-zorro-antd'; +import { Observable } from 'rxjs'; + @Component({ selector: 'app-customer', templateUrl: './customer.component.html', styleUrls: ['./customer.component.less'] }) export class CustomerComponent implements OnInit { + @ViewChild('chart') chart; + @ViewChild('pie') pie; public chose = ''; + resizeMark; constructor( private managemencs: ManagemencsService, private notification: NzNotificationService @@ -32,8 +37,20 @@ export class CustomerComponent implements OnInit { ngOnInit() { this.getAllCustomers(); + this.resizeMark = Observable.fromEvent(window,'resize') + .subscribe((event) => { + this.pie.resize(this.chart.nativeElement.offsetHeight,210) + }) } + ngAfterViewInit(){ + this.pie.resize(this.chart.nativeElement.offsetHeight,210) + } + + ngOnDestroy(){ + this.resizeMark.unsubscribe() + } + AllCustomersdata = []; AllServiceTypes = []; customerber = []; diff --git a/usecaseui-portal/src/app/views/home/home.component.ts b/usecaseui-portal/src/app/views/home/home.component.ts index 92e7e881..a7f312e6 100644 --- a/usecaseui-portal/src/app/views/home/home.component.ts +++ b/usecaseui-portal/src/app/views/home/home.component.ts @@ -31,7 +31,7 @@ export class HomeComponent implements OnInit { @HostBinding('@routerAnimate') routerAnimateState; @ViewChild('seriverChart') seriverChart; @ViewChild('services') services: ElementRef; - + resizeMark constructor( private myhttp: HomesService, @@ -49,18 +49,19 @@ export class HomeComponent implements OnInit { this.getHomeServiceBarNsData(); this.getHomeServiceBarVnfData(); this.getHomeServiceBarPnfData(); - Observable.fromEvent(window,'resize') + this.resizeMark = Observable.fromEvent(window,'resize') .subscribe((event) => { - this.seriverChart.resize(this.services.nativeElement.offsetHeight) + this.seriverChart.resize(this.services.nativeElement.offsetHeight,250) }) } ngAfterViewInit(){ - this.seriverChart.resize(this.services.nativeElement.offsetHeight) - - + this.seriverChart.resize(this.services.nativeElement.offsetHeight,250) } + ngOnDestroy(){ + this.resizeMark.unsubscribe() + } // services serviceNumber: number = 0; |