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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

sfchart not rendering. following sfchart getting started and when run chart is not showing up. I am not getting the right output as on gettingstarted section.

Thread ID:

Created:

Updated:

Platform:

Replies:

149762 Dec 8,2019 05:33 PM UTC Dec 9,2019 04:56 AM UTC Xamarin.Forms 1
loading
Tags: SfChart
Sheryl Buck
Asked On December 8, 2019 05:33 PM UTC

step1: 

Adding SfChart reference

You can add SfChart reference using one of the following methods:

Method 1: Adding SfChart reference from nuget.org =done

step 2: adding a line in appdelegate.cs =done

public override bool FinishedLaunching(UIApplication app, NSDictionary options)

{ 
     
    global::Xamarin.Forms.Forms.Init();

    Syncfusion.SfChart.XForms.iOS.Renderers.SfChartRenderer.Init();

    LoadApplication(new App()); 
    
}
step 3: importing sfchart namespace in xaml file = done
 xmlns:chart="clr-namespace:Syncfusion.SfChart.XForms;assembly=Syncfusion.SfChart.XForms" 
step 4: Then initialize an empty chart with PrimaryAxis and SecondaryAxis as shown below,

<?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:d="http://xamarin.com/schemas/2014/forms/design"

             xmlns:chart="clr-namespace:Syncfusion.SfChart.XForms;assembly=Syncfusion.SfChart.XForms"

             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="Chartsample.MainPage">

    <StackLayout>

        <!-- Place new controls here -->

        <Label Text="Welcome to Xamarin.Forms!" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" />

        <chart:SfChart>

    <chart:SfChart.PrimaryAxis>

        <chart:CategoryAxis>

        </chart:CategoryAxis>

    </chart:SfChart.PrimaryAxis>

    <chart:SfChart.SecondaryAxis>

        <chart:NumericalAxis>

        </chart:NumericalAxis>

    </chart:SfChart.SecondaryAxis>   

</chart:SfChart>

    </StackLayout>

</ContentPage>

Step 4: Run the project and check if you get following output to make sure you have configured your project properly to add SfChart. = It doesn't look like the one on your website when i run it.  = https://help.syncfusion.com/xamarin/charts/getting-started?cs-save-lang=1&cs-lang=xaml



Lavanya Anaimuthu [Syncfusion]
Replied On December 9, 2019 04:56 AM UTC

Hi hypnocool, 
 
Greetings from Syncfusion. 
 
We have validated the reported issue and we would like to let you know that the chart has a parent layout of StackLayout. You can resolve this issue by setting HorizontalOptions and VerticalOptions as FillAndExpand to the chart as per the below code snippet.  Because the desired size support only works for the Accumulation series. Hence for the Cartesian series, you must set Layout options as FillAndExpand or else set the size (Height and Width) for the chart.  
   
Code Snippet [XAML]:  
 
<StackLayout > 
        <!-- Place new controls here --> 
        <Label Text="Welcome to Xamarin.Forms!" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" /> 
        <chart:SfChart x:Name="Chart" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> 
            <chart:SfChart.PrimaryAxis> 
                <chart:CategoryAxis /> 
            </chart:SfChart.PrimaryAxis> 
            <chart:SfChart.SecondaryAxis> 
                <chart:NumericalAxis /> 
            </chart:SfChart.SecondaryAxis> 
        </chart:SfChart> 
    </StackLayout> 
 
 
 And we have prepared a sample based on your requirement and you can download the sample from the below link.  
   
 
Please let us know if any further assistance on this. 
 
Thanks, 
Lavanya A. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon