I need to fetch data when clicked on specific point on Line chart. This has been implemented on chart.js by this function getDatasetAtEvent(e). Any hint or help will be most appreciate?
hey @selimovicz ,
Will try to implement it this week.
thanks for patience.
@gor181 great, I appreciate that.
Hey @selimovicz ,
This should be solved in 1.5.1. Just get it from npm.
Usage:
<Bar
data={data}
width={100}
height={50}
getDatasetAtEvent={dataset => console.log(dataset)}
options={{
maintainAspectRatio: false
}}
/>
Let me know how it goes.
Edit: And reopen the task if needed 馃槃
Zdravo @gor181 , prvo hvala na brzom odgovoru :)
I found much more useful the following function: getElementAtEvent(), by using it I got single ChartElement with a bunch of object properties that are not my concern at the moment. But I couldn't find the way how to get X and Y value on that point, like it has been explained here: http://stackoverflow.com/questions/25514802/how-to-add-an-on-click-event-to-my-line-chart-using-chart-js.
I found the answer here: http://stackoverflow.com/a/37123117/1452505.
Thanks anyway.
Hvala.
This should _really_ be in the documentation! If I put together a PR, can it get added?
Most helpful comment
Hey @selimovicz ,
This should be solved in
1.5.1. Just get it from npm.Usage:
Let me know how it goes.
Edit: And reopen the task if needed 馃槃