Can't create a PlotModel

Jun 14, 2014 at 9:33 PM
Edited Jun 15, 2014 at 12:12 AM
The added or subtracted valued results in a unrepresentable DateTime.
That error gets thrown when I call
var Plot1 = new PlotModel();

Visual Studio points me to missing source code for PlotView.cs

Why is this all of a sudden happening?

Please help!!
Thanks in advance.
  public PlotModel makePlot(List<double> listNum, List<DateTime> times, List<double> listNum2, List<DateTime> times2)
        {
            var Plot1 = new PlotModel();
            Plot1.LegendSymbolLength = 24;
            Plot1.Title = "Two Lines";
            var objList = new List<Tuple<DateTime, double>>();
            

            for (int i = 0; i < listNum.Count; ++i)
            {
                objList.Add(new Tuple<DateTime, double>(times[i], listNum[i]));
                
            }
             

            // define an axis Date  
            var dateTimeAxis = new DateTimeAxis()
             {
                Position = AxisPosition.Bottom,
                IntervalType = DateTimeIntervalType.Milliseconds,
                StringFormat = "hh:mm:ss",
                TickStyle = TickStyle.Crossing,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot
             };

            // Convert object client  to  DataPoint
            var points = objList.Select(obj => new DataPoint(DateTimeAxis.ToDouble(obj.Item1), obj.Item2)).ToList();

            // Create Line
            var linearSeries = new LineSeries()
             {
                 ItemsSource = points,
                 Color = OxyColor.FromRgb(0,0,0)
                 
             };
            //pred values
            for (int i = 0; i < listNum2.Count; ++i)
            {
                objList.Add(new Tuple<DateTime, double>(times2[i], listNum2[i]));

            }



            // Convert object client  to  DataPoint
            var points2 = objList.Select(obj => new DataPoint(DateTimeAxis.ToDouble(obj.Item1), obj.Item2)).ToList();

            // Create Line
            var linearSeries2 = new LineSeries()
            {
                ItemsSource = points2,
                Color = OxyColor.FromRgb(43, 255, 43)

            };
            var linearAxis = new LinearAxis()
            {
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                Position = AxisPosition.Left,
                TickStyle = TickStyle.Crossing
            };

            Plot1.Axes.Add(dateTimeAxis);
            Plot1.Axes.Add(linearAxis);
            Plot1.Series.Add(linearSeries);
            Plot1.Series.Add(linearSeries2);

            return Plot1;
   

        }
Jun 15, 2014 at 4:59 AM
The problem was that I was trying to plot a null set.
Marked as answer by jessimb on 6/14/2014 at 8:59 PM