Click events doesn't generate dataPointIndex and seriesIndex for Pie Charts
See original GitHub issueBug report
Codepen
https://codepen.io/MadBoyEvo/pen/ExNbVeo
Explanation
- What is the behavior you expect?
Both dataPointSelection and click event should return dataPointindex or/and series for all types of events correctly.
- What is happening instead?
Following code behaves differently for different charts. For Pie charts only dataPointSelection provides dataPointIndex, but click event always return -1, -1. Click event for bar chart works correctly so I’m assuming this is a bug, not a feature. Maybe other chart types have the same issue.
events: {
dataPointSelection: function (event, chartContext, config) {
console.log(config.dataPointIndex + " " + config.seriesIndex);
},
click: function (event, chartContext, config) {
console.log(config.dataPointIndex + " " + config.seriesIndex);
}
}
- What error message are you getting?
No error message.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:11
Top Results From Across the Web
javascript - pie chart seriesIndex and dataPointIndex are
To get a reference to a pie slice clicked on you'll want to use the dataPointSelection function instead. This allows you to get...
Read more >ApexCharts - Pie Chart problem with Click Event - CodePen
Insecure Resource. The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https....
Read more >Button on click does not display pie charts - GIS Stack Exchange
In order for the button to work, the drawChart() function needs to be used in the HTML without any arguments. You must also...
Read more >events - ApexCharts.js
Fires when user clicks on the markers. chart: { events: { markerClick: function(event, chartContext, { seriesIndex, dataPointIndex, ...
Read more >TMS IntraWeb HTML5 Controls Pack Developers Guide
The chart also heavily implements asynchronous updates and events. ... This enables to show 360° pie charts, 180° pie charts or other.
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
Yeah this is a bug. I think you can get around this by using
event.target.parentElement.getAttribute("data:realIndex")
i.e
any idea? I’m getting
config.dataPointIndex
as -1 while hovering over a line graph