title: OxyPlot Chart Not Displaying On Xamarin Forms Portable Application
body: <p>I'm creating a PieChart using OxyPlot here in my Xamarin.Forms (Portable) Application. I created a ViewModel named <strong>PieViewModel</strong> where in I declare the content of the Pie Chart. In my <strong>SalesPage.XAML.cs</strong>, I call the ViewModel and access the <strong>salesmodel</strong> in it. In my XAML code, I bind the <strong>salesmodel</strong> in my code.</p>
  
  <p>However, I wasn't able to display the PieChart. Here are the codes I used:</p>
  
  <p><strong>PieViewModel.cs</strong></p>
  
  <pre><code>using OxyPlot;
  using OxyPlot.Series;
  using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Linq;
  using System.Runtime.CompilerServices;
  using System.Text;
  using System.Threading.Tasks;
  
      namespace XamarinFormsDemo.ViewModels
      {
          public class PieViewModel : INotifyPropertyChanged
          {
              private PlotModel modelP1;
              public PieViewModel()
              {
                  modelP1 = new PlotModel { Title = "Pie Sample1" };
  
                  dynamic seriesP1 = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0 };
  
                  seriesP1.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = false, Fill = OxyColors.PaleVioletRed });
                  seriesP1.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true });
                  seriesP1.Slices.Add(new PieSlice("Asia", 4157) { IsExploded = true });
                  seriesP1.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true });
                  seriesP1.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = true });
  
                  modelP1.Series.Add(seriesP1);
  
              }
  
              public PlotModel Model1
              {
                  get { return modelP1; }
                  set { modelP1 = value; }
              }
  
  
              public event PropertyChangedEventHandler PropertyChanged;
  
              protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
              {
                  PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
              }
  
          }
      }
  </code></pre>
  
  <p>.</p>
  
  <p><strong>SalesPage.XAML.cs</strong></p>
  
  <pre><code>using OxyPlot;
  using OxyPlot.Xamarin.Forms;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using XamarinFormsDemo.ViewModels;
  
  
  
  using Xamarin.Forms;
  
      namespace XamarinFormsDemo.Views
      {
          public partial class SalesPage : ContentPage
          {
  
              public SalesPage()
              {
  
              }
  
  
          }
      }
  </code></pre>
  
  <p>.
  <strong>SalesPage.XAML</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
           xmlns:oxy="clr-namespace:OxyPlot.Xamarin.Forms;assembly=OxyPlot.Xamarin.Forms"
           xmlns:ViewModels="clr-namespace:XamarinFormsDemo.ViewModels;assembly=XamarinFormsDemo"
           x:Class="XamarinFormsDemo.Views.SalesPage"
           BackgroundImage="bg3.jpg"
           Title="Sales Page"&gt;
  
  
  
      &lt;oxy:PlotView Model="{Binding Model1}" VerticalOptions="Center" HorizontalOptions="Center"/&gt;
  
  &lt;/ContentPage&gt;
  </code></pre>
  
  <p>.
  <strong>MainActivity.cs</strong></p>
  
  <pre><code>using System;
  using Android.App;
  using Android.Content.PM;
  using Android.Runtime;
  using Android.Views;
  using Android.Widget;
  using Android.OS;
  using ImageCircle.Forms.Plugin.Droid;
  using Xamarin.Forms.Platform.Android;
  
  namespace XamarinFormsDemo.Droid
  {
      [Activity(Label = "XamarinFormsDemo", Icon = "@drawable/recordsicon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
      public class MainActivity : AndroidActivity
      {
          protected override void OnCreate(Bundle bundle)
          {
              base.OnCreate(bundle);
  
              global::Xamarin.Forms.Forms.Init(this, bundle);
              OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();
              LoadApplication(new App());
              ImageCircleRenderer.Init();
          }
      }
  }
  </code></pre>
  
  <p>Please help me with this. I'm really getting confused on how the things are going. Thanks a lot. </p>