How to get correct chart ID when integrated with a grid

I have a simple chart integrated with grid. I added this…

myChart.attachEvent("onItemclick", function (id, ev, trg){ //any custom logic here console.log(id); console.log(ev); console.log(trg); });
When I click on the chart pie slices I get IDs that look like this: 1473282265867. That is not what I want. I need the IDs from the rows in the grid that the chart is based on. So how do I get the grid row IDs to propogate through to the chart?

Thanks!

Please share the code, which is used for loading data into the chart.