Hi Bruno,
In order to modify the labels in the iOS Platform, you need to create a custom renderer and work with the native control. Eventually, I suggest you have a look at the
iOS Chart Control documentation for more information on what customizations can be achieved. More specifically, you can have a detailed look at the following page -
Point Labels: Customizations. I am here providing a possible implementation of a custom renderer that changes the color of the label:
//argument needed to register the renderer
[assembly: Xamarin.Forms.ExportRenderer(
typeof
(Telerik.XamarinForms.Chart.RadPieChart),
typeof
(MyChartRenderer))]
namespace
TelerikXamarin.iOS.CustomRenderer
{
public
class
MyChartRenderer : Telerik.XamarinForms.ChartRenderer.iOS.PieChartRenderer
{
protected
override
TKChartDelegate CreateChartDelegate(RadPieChart chart)
{
return
new
MyChartDelegate(chart);
}
}
public
class
MyChartDelegate : Telerik.XamarinForms.ChartRenderer.iOS.PieChartDelegate
{
public
MyChartDelegate(RadPieChart chart) :
base
(chart)
{
}
public
override
TKChartPointLabel LabelForDataPoint(TKChart chart, TKChartData dataPoint,
string
propertyName, TKChartSeries series, nuint dataIndex)
{
TKChartDataPoint chartDataPoint = (TKChartDataPoint)dataPoint;
return
new
MyChartPointLabel(chartDataPoint, series, chartDataPoint.DataXValue.ToString());
}
}
public
class
MyChartPointLabel : TKChartPointLabel
{
public
MyChartPointLabel(TKChartDataPoint point, TKChartSeries series,
string
text) :
base
(point, series, text)
{
this
.Style.TextColor = UIColor.White;
}
}
}
I have also attached a sample application for your reference. I hope it will be helpful.
Regards,
Stefan Nenchev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the
Telerik Feedback Portal and vote to affect the priority of the items