We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

requestLayout() improperly called by com.syncfusion.charts.ChartRootLayout

Hello,

Im just starting out with forms, created a simple forms plc project

(VisualStudio 2015)
I have added nuget reference to http://nuget.syncfusion.com/xamarin

Then throught nuget manager added the reference: Syncfusion.xamarn.sfchart

The I made a simple page to test the charts, code below

But nothing is appearing, im getting an error:
06-20 13:29:30.532 W/View    ( 4391): requestLayout() improperly called by com.syncfusion.charts.ChartRootLayout{acfb4af8 V.E..... ......ID 20,20-1815,1130 #7f0b0064 app:id/rootLayout} during layout: running second layout pass

Could someone help me figure this out.

********************************************************************************
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xForms="clr-namespace:Syncfusion.SfChart.XForms;assembly=Syncfusion.SfChart.XForms"
             x:Class="ChartsTest.Page1"

  <xForms:SfChart>
    <xForms:SfChart.Series>
      <xForms:ColumnSeries ItemsSource = "{Binding HighTemperature}"/>
    </xForms:SfChart.Series>
</xForms:SfChart>
</ContentPage>


********************************************************************************
public partial class Page1 : ContentPage
    {
        public ObservableCollection<ChartDataPoint> HighTemperature { get; set; }
        public Page1()
        {
            HighTemperature = new ObservableCollection<ChartDataPoint>();
            HighTemperature.Add(new ChartDataPoint("Jan", 42));
            HighTemperature.Add(new ChartDataPoint("Feb", 44));
            HighTemperature.Add(new ChartDataPoint("Mar", 53));
            HighTemperature.Add(new ChartDataPoint("Apr", 64));
            HighTemperature.Add(new ChartDataPoint("May", 75));
            HighTemperature.Add(new ChartDataPoint("Jun", 83));
            HighTemperature.Add(new ChartDataPoint("Jul", 87));
            HighTemperature.Add(new ChartDataPoint("Aug", 84));
            HighTemperature.Add(new ChartDataPoint("Sep", 78));
            HighTemperature.Add(new ChartDataPoint("Oct", 67));
            HighTemperature.Add(new ChartDataPoint("Nov", 55));
            HighTemperature.Add(new ChartDataPoint("Dec", 45));

            InitializeComponent();
        }

***************************************************************************

2 Replies

MI Michal June 20, 2016 07:16 AM UTC

After reading some forums threads, I fugured this out, my defenition didn't have all the necessary properties


changed the def to this, and it worked


<chart:SfChart x:Name="Chart" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">


        <chart:SfChart.Legend>

          <chart:ChartLegend/>

        </chart:SfChart.Legend>

        <chart:SfChart.Title>

          <chart:ChartTitle Text="Student Score"/>

        </chart:SfChart.Title>

        <chart:SfChart.PrimaryAxis>

          <chart:CategoryAxis>

            <chart:CategoryAxis.Title>

              <chart:ChartAxisTitle Text="Name"/>

            </chart:CategoryAxis.Title>

          </chart:CategoryAxis>

        </chart:SfChart.PrimaryAxis>

        <chart:SfChart.SecondaryAxis>

          <chart:NumericalAxis>

            <chart:NumericalAxis.Title>

              <chart:ChartAxisTitle Text="Score"/>

            </chart:NumericalAxis.Title>

          </chart:NumericalAxis>

        </chart:SfChart.SecondaryAxis>

        <chart:SfChart.Series>

          <chart:BarSeries  Label = "High" ItemsSource = "{Binding Students}" XBindingPath="Name"
              EnableAnimation = "true"
              AnimationDuration="0.8"
 YBindingPath="Score"/>

        </chart:SfChart.Series>

      </chart:SfChart>


SP Saravana Pandian Murugan Syncfusion Team June 21, 2016 05:36 AM UTC

Hi Michal,

Thanks for update. We are glad that your issue is resolved. Please let us know if you need any further assistance.

Thanks,
Saravana Pandian M.

Loader.
Live Chat Icon For mobile
Up arrow icon