Hi Matthew,
Thanks for using Syncfusion product.
We have analyzed your query. Since the visible property in points is a public API, we can’t override its value in source while toggle the visibility by clicking legend. But you can get this in _visibility in the point as an work around. And also you can reject the hidden point of a series to find the total using the below code snippet, since the hidden point will not be taken in account for finding overall percentage.
ASP.NET MVC: @(Html.EJ().Chart("container") //... .LegendItemClick("pieChartSeriesChange") ) function pieChartSeriesChange(args) { var series = args.model.series; for (var i = 0; i < series.length; i++) { var total = 0; //Calculate total value for (var j = 0; j < series[i].points.length; j++) { if (series[i].points[j]._visibility == "visible" && args.data.legendItem.LegendItem.PointIndex != j) total += series[i].points[j].y; } for (j = 0; j < series[i].points.length; j++) series[i].points[j].text = series[i].points[j].x + ':- ' + (series[i].points[j].y / total * 100).toFixed(2) + '%'; } } |
Screenshot:
For your reference, we have attached the sample. Kindly find the sample from below location,
Thanks,
Dharani.