import { Component, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; @Component({ selector: 'ngx-d3-line', template: ` `, }) export class D3LineComponent implements OnDestroy { multi = [ { name: 'Germany', series: [ { name: '2010', value: 7300, }, { name: '2011', value: 8940, }, ], }, { name: 'USA', series: [ { name: '2010', value: 7870, }, { name: '2011', value: 8270, }, ], }, { name: 'France', series: [ { name: '2010', value: 5002, }, { name: '2011', value: 5800, }, ], }, ]; showLegend = true; showXAxis = true; showYAxis = true; showXAxisLabel = true; xAxisLabel = 'Country'; showYAxisLabel = true; 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(); } }