Get point index from chart.getPointsAtEvent(e)
See original GitHub issueHi, I am looking to make my chart a little more interactive and I would like to get a point
’s index (of its dataset
) with the following code:
canvas.onclick = function(e) {
const points = chart.getPointsAtEvent(e);
// something like `point.getIndex()` would be great so that I know where this point is in the original dataset
};
Anybody have a good solution for this?
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Chart.js: Get point index from chart.getPointsAtEvent(e)
js) a little more interactive and I would like to get a point's index (of its dataset) with the following code: canvas.onclick =...
Read more >[Solved]-Chart.js: Get point index from chart.getPointsAtEvent(e)
returns points from all datasets. So the same code would work irrespective of how many datasets you have or which of the datasets...
Read more >Chart.js: Get point index from chart.getPointsAtEvent(e)
I am looking to make my chart (made with Chart.js) a little more interactive and I would like to get a point's index...
Read more >How to Extract the Data Index of a Dataset when ... - YouTube
How to Extract the Data Index of a Dataset when Hover on Tooltip in Chart JSExtracting the data index and the dataset index...
Read more >How to Display Clicked Data Points in the Table in Chart JS
Sometimes you might want to extract the data points and insert them in a table. We will make a small interactive item where...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I made a workaround to get data from the clicked point; As we know, the hover event fires before the event click, so I suggest the following solution
@tyrex1975 It’s not working for me, an error
Uncaught TypeError: Cannot read property 'currentDevicePixelRatio' of undefined
not leaving me alone.