Repository navigation
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.
Activity
pulla2908 commentedon Sep 23, 2017
Is this issue now fixed? Any work around?
leedjones commentedon Sep 23, 2017
@pulla2908 not that I am aware of and no workaround either :(
pulla2908 commentedon Sep 26, 2017
@leedjones I am one step further!
First of all I got the solution from here: Xamarin Formus
This is my setup:
On Android it was rendering everytime. On iOS and UWP never. Then I set the PlotView like this:
VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"This change made it working immediately on iOS! But on UWP it was not rendering at all, but then if I resized the windows the rendering was done!
Next step: For UWP I upgraded to OxyPlot.Xamarin.Forms/1.1.0-unstable0011. I run the app again and rendering was done immediately!
Hope that helps!
br
Thomas
pulla2908 commentedon Oct 8, 2017
In addition to RELEASE) The compiler does some optimization. Therefore some assemblies are missing. To fix this I did following:
Note: This is only necessary for RELEASE, but not for DEBUG.
AloysiusParedes commentedon Mar 18, 2019
Is there a way to fix this in the current stable version? I am getting the exact same thing (Building for UWP with Xamarin.Forms)
markbangert commentedon Jul 30, 2019
I have exactly the same issue with UWP - the graph displays upon resizing... :(
Anybody got some more input how to resolve this?