Rabinder Bisht
Rabinder Bisht

Reputation: 604

How to get the coordinates of mouse click on a slice of pie-chart : Amcharts

I'm trying to get the coordinates of the mouse click on the amcharts pie-chart's slice. It is working for the whole page except the slices. event.pageX and event.clientX are not working, returning undefined. I want the coordinates with respect to the page.

{
    "event": "pullOutSlice",
    "method": function (event) {
                var relX = event.pageX;
                var relY = event.pageY;
   }
}

JSFIDDLE

Upvotes: 1

Views: 549

Answers (1)

shyammakwana.me
shyammakwana.me

Reputation: 5752

Is this what you are looking for ? https://jsfiddle.net/6w78zmo9/1/

Try this:

 var relX = event.chart.mouseX;
 var relY = event.chart.mouseY;

Upvotes: 3

Related Questions