This is a migrated thread and some comments may be shown as answers.
PieChart series are not centered on iOS
1 Answer 4 Views
This is a migrated thread and some comments may be shown as answers.
Alexei
Top achievements
Rank 1
Alexei asked on 02 Sep 2016, 04:32 PM

Hi Telerik team!

Trying to display a simple chart. It works fine in Android, but in iOS it looks like series are not centered. (screen attached)

Could you please help with it?

<telerikChart:RadPieChart Palette="{x:Static viewModels:BenefitsViewModel.CustomChartPalette}" BackgroundColor="Aqua"
                                                    RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.5, Constant=-100}"
                                                    RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=50}"
                                                    RelativeLayout.WidthConstraint="{ConstraintExpression Type=Constant, Constant=200}"
                                                    RelativeLayout.HeightConstraint="{ConstraintExpression Type=Constant, Constant=200}" Rotation="90">
                                              <telerikChart:RadPieChart.Series>
                                                <telerikChart:PieSeries ItemsSource="{Binding PieChartBenefitsData}" AllowSelect="False" ShowLabels="False" >
                                                  <telerikChart:PieSeries.ValueBinding>
                                                    <telerikChart:PropertyNameDataPointBinding PropertyName="Value"/>
                                                  </telerikChart:PieSeries.ValueBinding>
                                                </telerikChart:PieSeries>
                                              </telerikChart:RadPieChart.Series>
                                            </telerikChart:RadPieChart>

1 Answer, 1 is accepted

Sort by
0
Tsvyatko
Telerik team
answered on 06 Sep 2016, 08:53 AM
Hello Alexei,

I can confirm the issue from our side. We will address it in our next official release (due in the mid September).

Meanwhile I can suggest the following workaround:

 - define custom renderer in ios project:
public class CustomChartRenderer : PieChartRenderer
   {
       protected override void OnElementChanged(ElementChangedEventArgs<RadPieChart> e)
       {
           base.OnElementChanged(e);
           this.Control.Insets = new UIKit.UIEdgeInsets(10, 10, 10, 10);
       }
   }

- Set it as renderer for the pie chart:
[assembly: Xamarin.Forms.ExportRenderer(typeof(Telerik.XamarinForms.Chart.RadPieChart), typeof(CustomChartRenderer))]

Please excuse us for the inconvenience caused.

Regards,
Tsvyatko
Telerik by Progress
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
Tags
Chart
Asked by
Alexei
Top achievements
Rank 1
Answers by
Tsvyatko
Telerik team
Share this question
or