I have an Angular Ngx vertical chart , and I need to get only x axis number. I want to use this x axis number at onSelect function.
Html :
<ngx-charts-bar-vertical
[xAxisLabel]="xAxisLabel"
[yAxisLabel]="yAxisLabel"
(select)="onSelect($event)"
[results]="dataSource">
</ngx-charts-bar-vertical>
DataSource :
[ {userId: 5, name: "User Name example", value: 69.6} ... ]
I want to get "userId" part in fact, but i couldn't . When I select a bar , onSelect is getting only the "name" and the "value" parts, but not 'userId' part.
In reality, i want that the exactly opposite of this stuff
: https://github.com/swimlane/ngx-charts/issues/409
Here want to hide allData but i want to get all data when i click a bar.
So i think that :
- Get x axis number
- userId = dataSource[xAxisNumber].userId;
How can i do that ?