Open
Description
Steps to reproduce
- Create a new Xamarin Forms Blank App
- Add OxyPlot libraries via Nuget (Oxyplot.Xamarin.Forms) as per documentation
- Add initialization code to each project as per the documentation
- Generate a graph data using the code behind and bind to it in the XAML. e.g.
<?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:oxy="clr-namespace:OxyPlot.Xamarin.Forms;assembly=OxyPlot.Xamarin.Forms"
xmlns:local="clr-namespace:OxyPlotTestApp"
x:Class="OxyPlotTestApp.MainPage">
<AbsoluteLayout>
<oxy:PlotView Model="{Binding PieModel}" AbsoluteLayout.LayoutBounds="20,0,.9,.9"
AbsoluteLayout.LayoutFlags="WidthProportional,HeightProportional" />
</AbsoluteLayout>
</ContentPage>
namespace OxyPlotTestApp
{
public class PieViewModel
{
public PlotModel PieModel { get; set; }
public PieViewModel()
{
PieModel = CreatePieChart();
}
private PlotModel CreatePieChart()
{
var model = new PlotModel { Title = "World Population By Content" };
var ps = new PieSeries
{
StrokeThickness = .25,
InsideLabelPosition = 0.25,
AngleSpan = 360,
StartAngle = 0
};
ps.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = false });
ps.Slices.Add(new PieSlice("Americas", 929) { IsExploded = false });
ps.Slices.Add(new PieSlice("Asia", 4157));
ps.Slices.Add(new PieSlice("Europe", 739) { IsExploded = false });
ps.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = false });
model.Series.Add(ps);
return model;
}
}
public partial class MainPage : ContentPage
{
public PieViewModel vm { get; set; }
public MainPage()
{
InitializeComponent();
vm = new PieViewModel();
this.BindingContext = vm;
}
}
}
- Run the UWP version of the application
Platform: Xamarin Forms UWP
.NET version:
Expected behaviour
Graph should display as per other platforms
Actual behaviour
Nothing is displayed on screen. According to this thread on StackOverflow another user can see this but if they resize the window the chart renders. However, this does not happen for me.
Tested on two machines (custom built desktop and a Surface Pro 4) and experience the same behaviour. Tested on Android, both the emulator and a physical device, and both work as expected, so it would seem to be just the UWP version.