Pie Chart - Get data from clicked area

Hi Syncfusion team,
i got a pie chart on my app, and i added a mouseclick event.
I get correctly wich part is clicked in form of: pieChart_Series_0_Point_0, pieChart_Series_0_Point_1 etc.
How can i get info like label name of the clicked area?
pieChart = new ej.charts.AccumulationChart({
series:[{
dataSource : pieChartData,
radius: '100%',
xName: 'tipo',
yName: 'valor'
}],
chartMouseClick:function(args)
{
console.log("mousclick");
console.log(args.target);


},
tooltip:{enable:true}

});
pieChart.appendTo("#pieChart");

3 Replies

DD Dharanidharan Dharmasivam Syncfusion Team August 21, 2018 09:40 AM UTC

Hi Miguel, 

Your requirement can be achieved in a simple way using pointClick event. This event will be triggered when clicked on a point in accumulation chart. We have prepared a sample in which we have shown the x and y values of a point in an alert box using the pointClick event. You can change this with respect to your scenario. Find the code snippet below to achieve this. 

JS: 

var pie = new ej.charts.AccumulationChart({ 
        pointClick: function (args){ 
          alert("X : "+ args.point.x + "\nY : "+ args.point.y) 
        } 
    }); 


Screenshot: 
 
Sample for reference can be find from below link. 

Thanks, 
Dharani. 



MV Miguel Varela Rodriguez August 23, 2018 10:23 AM UTC

thank you! like always great support!


DD Dharanidharan Dharmasivam Syncfusion Team August 23, 2018 10:36 AM UTC

Hi Miguel, 
 
Most welcome. You can get in touch with us, if you would require any further assistance and we are always happy to assist you. 
 
Thanks, 
Dharani. 


Loader.
Up arrow icon