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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfChart Not Displaying

Thread ID:

Created:

Updated:

Platform:

Replies:

124585 Jun 15,2016 07:26 PM UTC Feb 20,2019 12:16 PM UTC Xamarin.Forms 7
loading
Tags: SfChart
Drew Wilson
Asked On June 15, 2016 07:26 PM UTC

I'm trying to add SfChart to my Xamarin.Forms project by following the example here


I installed SfChart through the NuGet package manager in Visual Studio 2015 and then added PCL, iOS and Android references as shown in the example


My xaml file resembles the following:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                       xmlns:local="clr-namespace:Test;assembly=Test"
                       xmlns:chart="clr-namespace:Syncfusion.SfChart.XForms;assembly=Syncfusion.SfChart.XForms"
                       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                       x:Class="Test.PageName">
  <ContentPage.Content>
    <StackLayout ...>
      ...
      <chart:SfChart>
      <chart:SfChart.Title>
        <chart:ChartTitle Text="Weather Analysis" />
      </chart:SfChart.Title>
        <chart:SfChart.PrimaryAxis>
          <chart:CategoryAxis>
             <chart:CategoryAxis.Title>
                 <chart:ChartAxisTitle Text="Month"/>
             </chart:CategoryAxis.Title>
          </chart:CategoryAxis>
      </chart:SfChart.PrimaryAxis>
      <chart:SfChart.SecondaryAxis>
        <chart:NumericalAxis>
            <chart:NumericalAxis.Title>
                <chart:ChartAxisTitle Text="Month"/>
            </chart:NumericalAxis.Title>
        </chart:NumericalAxis>
      </chart:SfChart.SecondaryAxis>
      <chart:SfChart.Series>
        <chart:ColumnSeries ItemsSource = "{Binding HighTemperature}"/>
      </chart:SfChart.Series>
    </chart:SfChart>
      ...
    </StackLayout>
  </ContentPage.Content>
</ContentPage>

My xaml.cs file resembles the follwing:

using Xamarin.Forms;
namespace Test
{
  public partial class Page : ContentPage
  {
    public Page()
    {
      InitializeComponent();
    }
  }
}

<?xml version="1.0" encoding="utf-8" ?>

I've added to the iOS AppDelegate.cs and Android MainActivity.cs file:

new SfChartRenderer();

I've created a DataSource model:

namespace Test.Models

{

  public class DataModel

  {

      public ObservableCollection<ChartDataPoint>  HighTemperature { get; set; }

    

      public DataModel ()

      {

           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));

      }

  }

}

The application builds and deploys properly and all pages display properly - there is just now chart shown. Any ideas?

Thanks in advance!


Gobi M [Syncfusion]
Replied On June 16, 2016 10:38 AM UTC

Hi Drew Wilson, 
 
Thanks for contacting Syncfusion support. 
 
We have prepared a xaml sample by following our getting started tutorial and it is working fine. The sample can be downloaded in below location. 
 
 
Please let us know for any queries.  
 
Regards, 
Gobi M 


Drew Wilson
Replied On June 20, 2016 07:18 PM UTC

I was able to make this work using your example.

Thanks!

Gobi M [Syncfusion]
Replied On June 21, 2016 03:58 AM UTC

Hi Drew Wilson, 
 
Thanks for the update. 
 
Please let us know for any queries. 
 
Regards, 
Gobi M 


tom anderson
Replied On April 20, 2018 03:35 AM UTC

Hi,

This is very helpful. I am new to Xamarin so teaching myself how to work with charts.

In the above sample, I am not able to find ChartDataPoint. Can you please point me to the right direction?

Parthiban Sundaram [Syncfusion]
Replied On April 23, 2018 06:50 AM UTC

Hi Tom Anderson,

Thanks for using Syncfusion products.

You can refer the following link to know about ChartDataPoint.

https://help.syncfusion.com/xamarin/sfchart/working-with-data#chart-data-point  

Also, we have prepared the simple sample for this. Please download it from following location.

Sample: http://www.syncfusion.com/downloads/support/forum/124585/ze/SimpleSample-732480229  

Please let us know, if you have further assistance on this.

Regards,
Parthiban S.

ikanih solomon
Replied On February 19, 2019 04:44 PM UTC

am trying to add dummy data into my app...but I get this error "Unhandled Exception:

System.MissingMethodException: Default constructor not found for type Com.Syncfusion.Charts.SfChart".

Gone through the guidelines/documentation a couple of times, and cant find any reference to a constructor.


Bharathiraja K [Syncfusion]
Replied On February 20, 2019 12:16 PM UTC

Hi ikanih, 
 
Can you please share your application scenario or code snippet to replicate the issue reported issue? Since we are not aware of your exact application scenario, we were not able to reproduce this issue at our end, so can you please revert us by modifying the sample based on your application along with replication procedure. This will be helpful for us to investigate further and provide you a better solution at the earliest. 
 
Sample link:   
 
Thanks, 
Bharathiraja.  


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

;