import { Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ selector: 'ngx-d3-bar', template: ` `, }) export class D3BarComponent implements OnDestroy { results = [ { name: 'Germany', value: 8940 }, { name: 'USA', value: 5000 }, { name: 'France', value: 7200 }, ]; showLegend = true; showXAxis = true; showYAxis = true; xAxisLabel = 'Country'; yAxisLabel = 'Population'; colorScheme: any; themeSubscription: any; constructor(private theme: NbThemeService) { this.themeSubscription = this.theme.getJsTheme().subscribe(config => { const colors: any = config.variables; this.colorScheme = { domain: [colors.primaryLight, colors.infoLight, colors.successLight, colors.warningLight, colors.dangerLight], }; }); } ngOnDestroy(): void { this.themeSubscription.unsubscribe(); } }