尝试将OxyPlot添加到Xamarin表单xaml页面
我正试图将oxyplot纳入一个Xamarin.Forms-Project中 这是我的Xaml.cs文件,我在其中构建PlotModel尝试将OxyPlot添加到Xamarin表单xaml页面,xaml,xamarin.forms,oxyplot,Xaml,Xamarin.forms,Oxyplot,我正试图将oxyplot纳入一个Xamarin.Forms-Project中 这是我的Xaml.cs文件,我在其中构建PlotModel private void GeneratePlot() { var Points = new List<DataPoint> { new DataPoint(0, 0), new DataPoint(10, 5), new DataPoi
private void GeneratePlot()
{
var Points = new List<DataPoint>
{
new DataPoint(0, 0),
new DataPoint(10, 5),
new DataPoint(20, 10),
new DataPoint(30, 16),
new DataPoint(40, 12),
new DataPoint(50, 19)
};
var Points2 = new List<DataPoint>
{
new DataPoint(0, 0),
new DataPoint(10, 7),
new DataPoint(20, 8),
new DataPoint(30, 8),
new DataPoint(40, 20),
new DataPoint(50, 25)
};
var m = new PlotModel();
m.PlotType = PlotType.XY;
m.InvalidatePlot(true);
m.Title = "hello oxy";
m.ResetAllAxes();
var ls1 = new LineSeries();
var ls2 = new LineSeries();
ls1.ItemsSource = Points;
ls2.ItemsSource = Points2;
m.Series.Add(ls1);
m.Series.Add(ls2);
var _opv = new OxyPlotView
{
WidthRequest = 300,
HeightRequest = 300,
BackgroundColor = Color.Aqua
};
_opv.Model = m;
PlModel = m;
}
有人知道我可以如何使用OxyPlot和Xaml吗
非常感谢请确保OxyPlot的版本与表单的版本兼容
过去,我不得不手动下载OxyPlot源代码并更新Xamarin.Forms NuGet。如何确定它们是否兼容?NuGet软件包通常会在说明中说明与哪个版本兼容。您使用的是哪个版本的表单?在我的参考资料Xamarin.Forms.Core和Xamarin.Forms.Xaml中,哪个版本的Oxy?Hi是1.4 Xamarin.Forms.Platform是1.0。OxyPlot和OxyPlot.xamarin格式为2014.1.517.0
<oxy:PlotView Model="{Binding Model}" VerticalOptions="Center" HorizontalOptions="Center" />
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: An exception was thrown by the type initializer for OxyPlot.XamarinForms.PlotView ---> System.MissingMethodException: Method not found: 'Xamarin.Forms.BindableProperty.Create'.