0
我不確定爲什麼參考文獻中有錯誤。 OxyPlot.Wpf.LineSeries
到OxyPlot.Series.Series
System.Collections.ObjectModel.Collection.Add(OxyPlot.Axes.Axis)
的最佳重載方法匹配有一些無效參數。參考中的錯誤
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OxyPlot;
using OxyPlot.Wpf;
using OxyPlot.Axes;
namespace points
{
public class PsdTest
{
public static PlotModel Filteringinvalidpoints()
{
var plotModel1 = new PlotModel();
plotModel1.Title = "Filtering invalid points";
var linearAxis1 = new LinearAxis();
linearAxis1.Position = AxisPosition.Bottom;
linearAxis1.Title = "X-axis";
plotModel1.Axes.Add(linearAxis1);
var linearAxis2 = new LinearAxis();
linearAxis2.Title = "Y-axis";
plotModel1.Axes.Add(linearAxis2);
var lineSeries1 = new LineSeries();
lineSeries1.Title = "NaN";
lineSeries1.Points.Add(new DataPoint(double.NaN, double.NaN));
lineSeries1.Points.Add(new DataPoint(1, 0));
lineSeries1.Points.Add(new DataPoint(2, 10));
lineSeries1.Points.Add(new DataPoint(double.NaN, 20));
lineSeries1.Points.Add(new DataPoint(3, 10));
lineSeries1.Points.Add(new DataPoint(4, 0));
lineSeries1.Points.Add(new DataPoint(4.5, double.NaN));
lineSeries1.Points.Add(new DataPoint(5, 0));
lineSeries1.Points.Add(new DataPoint(6, 10));
lineSeries1.Points.Add(new DataPoint(double.NaN, double.NaN));
lineSeries1.Points.Add(new DataPoint(7, 0));
lineSeries1.Points.Add(new DataPoint(double.NaN, double.NaN));
plotModel1.Series.Add(lineSeries1);
var lineSeries2 = new LineSeries();
lineSeries2.Title = "PositiveInfinity";
lineSeries2.Points.Add(new DataPoint(double.PositiveInfinity, double.PositiveInfinity));
lineSeries2.Points.Add(new DataPoint(1, 1));
lineSeries2.Points.Add(new DataPoint(2, 11));
lineSeries2.Points.Add(new DataPoint(double.PositiveInfinity, 20));
lineSeries2.Points.Add(new DataPoint(3, 11));
lineSeries2.Points.Add(new DataPoint(4, 1));
lineSeries2.Points.Add(new DataPoint(4.5, double.PositiveInfinity));
lineSeries2.Points.Add(new DataPoint(5, 1));
lineSeries2.Points.Add(new DataPoint(6, 11));
lineSeries2.Points.Add(new DataPoint(double.PositiveInfinity, double.PositiveInfinity));
lineSeries2.Points.Add(new DataPoint(7, 1));
lineSeries2.Points.Add(new DataPoint(double.PositiveInfinity, double.PositiveInfinity));
plotModel1.Series.Add(lineSeries2);
var lineSeries3 = new LineSeries();
lineSeries3.Title = "NegativeInfinity";
lineSeries3.Points.Add(new DataPoint(double.NegativeInfinity, double.NegativeInfinity));
lineSeries3.Points.Add(new DataPoint(1, 2));
lineSeries3.Points.Add(new DataPoint(2, 12));
lineSeries3.Points.Add(new DataPoint(double.NegativeInfinity, 20));
lineSeries3.Points.Add(new DataPoint(3, 12));
lineSeries3.Points.Add(new DataPoint(4, 2));
lineSeries3.Points.Add(new DataPoint(4.5, double.NegativeInfinity));
lineSeries3.Points.Add(new DataPoint(5, 2));
lineSeries3.Points.Add(new DataPoint(6, 12));
lineSeries3.Points.Add(new DataPoint(double.NegativeInfinity, double.NegativeInfinity));
lineSeries3.Points.Add(new DataPoint(7, 2));
lineSeries3.Points.Add(new DataPoint(double.NegativeInfinity, double.NegativeInfinity));
plotModel1.Series.Add(lineSeries3);
return plotModel1;
}
}
}