import { Component , OnDestroy } from '@angular/core' ; import { NbThemeService } from '@nebular/theme' ; @ Component ( { selector : 'ngx-d3-bar' , template : `
    <ngx-charts-bar-vertical
      [scheme]="colorScheme"
      [results]="results"
      [xAxis]="showXAxis"
      [yAxis]="showYAxis"
      [legend]="showLegend"
      [xAxisLabel]="xAxisLabel"
      [yAxisLabel]="yAxisLabel">
    </ngx-charts-bar-vertical>
  ` , } ) 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 ) { this . themeSubscription = this . theme . getJsTheme ( ) . subscribe ( config => { const colors = config . variables ; this . colorScheme = { domain : [ colors . primaryLight , colors . infoLight , colors . successLight , colors . warningLight , colors . dangerLight ] , } ; } ) ; } ngOnDestroy ( ) { this . themeSubscription . unsubscribe ( ) ; } }