Gnik
Gnik

Reputation: 7436

How can I get the bars of the carbon design charts?

I am working with Angular15 and Carbon Design System.

Do we have any options to get all the bar elements in <ibm-simple-bar-chart> to customize something programmatically. Want to iterate individual <svg><path> (bars) elements

Below is the current implementation

HTML

<div>
    <ibm-simple-bar-chart [data]="chartData" [options]="chartOptions" #simpleBar></ibm-simple-bar-chart>
</div>

bar-chart.component.ts

import {AfterViewInit, Component, ViewChild} from '@angular/core';

 @Component({
  selector: 'bar-chart',
  templateUrl: './bar-chart.component.html',
  styleUrls: [],
 })
 export class SimpleBarChartComponent implements AfterViewInit {
 public chartData: any[] = [];
 public chartOptions: any = {};
 @ViewChild('simpleBar', {static: false})
 public barChart: any;

 public ngAfterViewInit(): void {
    if (this.barChart) {
      // I want to perform custom logic here
    }
  }
 }

Upvotes: 0

Views: 69

Answers (0)

Related Questions