Beispiel #1
0
        private static void FillPlot(PlotModel plot, Graphable xGraph, Graphable yGraph)
        {
            var xStats = xGraph.GetStats();
            var yStats = yGraph.GetStats();
            var xAxis  = MakeAxis(AxisPosition.Bottom, xGraph.ToString(), xStats);
            var yAxis  = MakeAxis(AxisPosition.Left, yGraph.ToString(), yStats);

            plot.Axes.Add(xAxis);
            plot.Axes.Add(yAxis);
            var series = new LineSeries();

            plot.Series.Add(series);
            var points = xStats.DataPoints.Concat(yStats.DataPoints)
                         .Select(p => new
            {
                x = xStats.ValueAt(p.Time),
                y = yStats.ValueAt(p.Time),
            })
                         .OrderBy(p => p.x);

            foreach (var point in points)
            {
                series.Points.Add(new DataPoint
                                      (point.x
                                      , point.y
                                      ));
            }
            plot.InvalidatePlot(false);
        }
Beispiel #2
0
 public GraphWindow(Graphable xStats, Graphable yStats)
 {
     InitializeComponent();
     DataContext = new GraphViewModel(xStats, yStats);
 }
Beispiel #3
0
 public GraphViewModel(Graphable xStats, Graphable yStats)
 {
     Plot = new PlotModel();
     FillPlot(Plot, xStats, yStats);
     Title = $"{yStats} over {xStats}";
 }