import { Component, AfterViewInit } from '@angular/core' import { BaseChartComponent } from './base-chart.component' import { SimpleBarChart as SimpleBarChartCore, type BarChartOptions } from '@carbon/charts' /** * Wrapper around `SimpleBarChart` in carbon charts library * * Most functions just call their equivalent from the chart library. */ @Component({ selector: 'ibm-simple-bar-chart, cc-bar', template: `` }) export class SimpleBarChartComponent extends BaseChartComponent implements AfterViewInit { /** * Runs after view init to create a chart, attach it to `elementRef` and draw it. */ override ngAfterViewInit() { this.chart = new SimpleBarChartCore(this.elementRef.nativeElement as HTMLDivElement, { data: this.data, options: this.options as BarChartOptions }) Object.assign(this, this.chart) } }