Hi i'm trying to use viser-ng
and I need to call a function onClick
event.
But when I try to use this
inside my calling function I am getting an error this is undefined
.
<v-chart [forceFit]="forceFit" [height]="height" [data]="data" [onClick]="clickbar"></-chart>
In my component
clickbar(e: any) {
console.log('clickbar', e.target); // return clicked data
console.log("this", this); // return undefined
this.openDialog(e.data._origin) // error
}
openDialog(data): void {
console.log(data) // error
}
Can you explain me how can I call my openDialog
function ?
Trying (click)="clickbar($event)"
but $event
return mouseevent
not clickedData