I'm using MpAndroidChart(UltimateXF) for my app. I created the piechart successfully but I am unable to create a event listener to get the clicked item when user touched one of piechart item.
This is my UltimateXF library....
https://nuget.org/packages/UltimateXF/
This is my code....
public partial class HomePage : ContentPage
{
public HomePage ()
{
InitializeComponent ();
var entries = new List<PieEntry>();
entries.Add(new PieEntry(40, "Life"));
entries.Add(new PieEntry(60, "General"));
var dataSet4 = new PieDataSet(entries, "")
{
Colors = new List<Color>()
{
Color.Accent, Color.Chocolate
},
ValueLineColor = Color.Blue,
SliceSpace = 2f,
ValueFormatter = new CustomPercentDataSetValueFormatter()
};
var data4 = new PieChartData(dataSet4)
{
};
var dataSet5 = new PieDataSet(entries, "")
{
};
pieChart.ChartData = data4;
pieChart.RotateEnabled = false;
}
}
public class CustomPercentDataSetValueFormatter : IDataSetValueFormatter
{
public string GetFormattedValue(float value, int dataSetIndex)
{
return value + "%";
}
}