Ran this on StackBlitz
import { Component } from '@angular/core';
import {
LegendLabelsContentArgs,
SeriesClickEvent,
} from '@progress/kendo-angular-charts';
import { IntlService } from '@progress/kendo-angular-intl';
@Component({
selector: 'my-app',
template: `
<kendo-chart
(plotAreaClick)="onClick($event)"
[transitions]="false"
title="World Population by Broad Age Groups"
>
<kendo-chart-legend position="bottom"></kendo-chart-legend>
<kendo-chart-series>
<kendo-chart-series-item
type="donut"
[data]="pieData"
field="value"
categoryField="category"
explodeField="exploded"
[labels]="{ visible: true, content: labelContent }"
>
</kendo-chart-series-item>
</kendo-chart-series>
</kendo-chart>
`,
})
export class AppComponent {
public pieData: Array<{
category: string;
value: number;
exploded: boolean;
}> = [
{ category: '0-14', value: 0.2545, exploded: false },
{ category: '15-24', value: 0.1552, exploded: false },
{ category: '25-54', value: 0.4059, exploded: false },
{ category: '55-64', value: 0.0911, exploded: false },
{ category: '65+', value: 0.0933, exploded: false },
];
constructor(private intl: IntlService) {
this.labelContent = this.labelContent.bind(this);
}
public labelContent(args: LegendLabelsContentArgs): string {
return `${args.dataItem.category} years old: ${this.intl.formatNumber(
args.dataItem.value,
'p2'
)}`;
}
public onClick(event: any): void {
console.log('Click');
}
}
When the event is seriesClick, it works as expected, and if I change the type to bar, it works as expected, but when it's as shown as above, the onClick event isn't triggered.
As I have donuts/pies that might not have data in it, I needed to use plotAreaClick (which I have done for the bar charts)
Thanks,