2014-04-06 106 views
0

我不確定爲什麼參考文獻中有錯誤。 OxyPlot.Wpf.LineSeriesOxyPlot.Series.SeriesSystem.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; 
     } 

    } 
} 

回答

0

這聽起來像是你遇到了一些不同的命名空間的問題。我不能說我完全理解你在嘗試什麼,所以這可能不會給你想要的結果,但是我可以使用以下命名空間(通過nuget安裝OxyPlot.Wpf)來編譯代碼:

using OxyPlot; 
using OxyPlot.Axes; 
using OxyPlot.Series; 

可能是這種情況,如果您發現您在名稱空間中發現了某些特定行爲,那麼這對您沒有任何幫助。