Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chartClick event dont work for Doughnut chart #1411

Open
datskill opened this issue Jun 2, 2022 · 1 comment
Open

chartClick event dont work for Doughnut chart #1411

datskill opened this issue Jun 2, 2022 · 1 comment

Comments

@datskill
Copy link

datskill commented Jun 2, 2022

Reproduction of the problem

Hi, i tried from here https://valor-software.com/ng2-charts/#DoughnutChart and in my own code

    <canvas
      baseChart
      [data]="dataSet"
      [options]="chartOptions"
      [legend]="false"
      [type]="doughnutChartType"
      [plugins]="chartPlugins"
      height="1"
      width="1"
      (chartClick)="chartClicked($event)"
    >
      ></canvas
  public chartClicked({
    event,
    active,
  }: {
    event: MouseEvent;
    active: {}[];
  }): void {
    console.log(event, active);
  }

the event isnt triggered, anyone knows why ?

@uxerscode
Copy link

You may have to change your event function to the following:
chartClicked({ event, active }: { event?: ChartEvent | undefined, active?: {}[] | undefined }): void {
console.log(event, active);
}
depending on your typescript/angular version.
At least, that's what I had to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants