public void SetFrametimeChart(IList <Point> frametimePoints)
        {
            if (frametimePoints == null || !frametimePoints.Any())
            {
                return;
            }

            int count = frametimePoints.Count;
            var frametimeDataPoints = frametimePoints.Select(pnt => new DataPoint(pnt.X, pnt.Y));
            var yMin          = frametimePoints.Min(pnt => pnt.Y);
            var yMax          = frametimePoints.Max(pnt => pnt.Y);
            var movingAverage = FrametimesStatisticProvider
                                .GetMovingAverage(frametimePoints.Select(pnt => pnt.Y)
                                                  .ToList(), AppConfiguration.MovingAverageWindowSize);

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                FrametimeModel.Series.Clear();
                var frametimeSeries = new LineSeries
                {
                    Title                 = "Frametimes",
                    StrokeThickness       = 1,
                    LegendStrokeThickness = 4,
                    Color                 = ColorRessource.FrametimeStroke
                };
                var movingAverageSeries = new LineSeries
                {
                    Title = string.Format(CultureInfo.InvariantCulture,
                                          "Moving average (window size = {0})", AppConfiguration.MovingAverageWindowSize),
                    StrokeThickness       = 2,
                    LegendStrokeThickness = 4,
                    Color = ColorRessource.FrametimeMovingAverageStroke
                };

                frametimeSeries.Points.AddRange(frametimeDataPoints);
                movingAverageSeries.Points.AddRange(movingAverage.Select((y, i) => new DataPoint(frametimePoints[i].X, y)));

                var xAxis = FrametimeModel.GetAxisOrDefault("xAxis", null);
                //var yAxis = FrametimeModel.GetAxisOrDefault("yAxis", null);

                xAxis.Minimum = frametimePoints.First().X;
                xAxis.Maximum = frametimePoints.Last().X;
                //yAxis.Minimum = yMin - (yMax - yMin) / 6;
                //yAxis.Maximum = yMax + (yMax - yMin) / 6;

                FrametimeModel.Series.Add(frametimeSeries);
                FrametimeModel.Series.Add(movingAverageSeries);

                FrametimeModel.InvalidatePlot(true);
            }));
        }
        private void OnTimeOffsetChanged()
        {
            if (_points == null || !_points.Any())
            {
                return;
            }

            // Update frametime graph sliding window
            var ls = new LineSeries {
                Title = "Test samples", StrokeThickness = 1, Color = OxyColor.FromRgb(139, 35, 35)
            };

            var    slidingWindow = _points.Where(p => p.X >= TimeOffset && p.X <= TimeOffset + SelectableTime);
            double minXWindow    = slidingWindow.First().X;

            foreach (var point in slidingWindow)
            {
                ls.Points.Add(new DataPoint(point.X - minXWindow, point.Y));
            }

            FrametimeModel.Series.Clear();
            FrametimeModel.Series.Add(ls);
            FrametimeModel.InvalidatePlot(true);
        }