PieChart series are not centered on iOS

2 posts, 0 answers
  1. Alexei
    Alexei avatar
    2 posts
    Member since:
    Sep 2016

    Posted 02 Sep Link to this post

    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>

  2. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 06 Sep Link to this post

    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
  3. DevCraft banner
Back to Top