public IAggregatedChartViewModel CreateAggregatedChartViewModel()
        {
            IReadOnlyCollection <LapTelemetryDto> loadedLaps = _loadedLapsCache.LoadedLaps;
            string title = $"{ChartName} - Laps: {string.Join(", ", loadedLaps.Select(x => x.LapSummary.CustomDisplayName))}";

            AxisDefinition xAxis       = new AxisDefinition(_dataExtractor.XMajorTickSize, _dataExtractor.XMajorTickSize / 4, _dataExtractor.XUnit, "Lat Acc");
            AxisDefinition yAxis       = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit, "Long Acc");
            ScatterPlot    scatterPlot = new ScatterPlot(title, xAxis, yAxis);

            for (int i = 0; i < 4; i++)
            {
                _throttlePositionFilter.Minimum = i * 0.25;;
                _throttlePositionFilter.Maximum = (i + 1) * 0.25;
                string seriesTitle = $"Throttle - {i * 25}% - {(i + 1) * 25:F2}%";
                scatterPlot.AddScatterPlotSeries(_dataExtractor.ExtractSeries(loadedLaps, _filters, seriesTitle, ColorMap[i]));
            }

            _throttlePositionFilter.Minimum = 1;
            _throttlePositionFilter.Maximum = double.MaxValue;
            scatterPlot.AddScatterPlotSeries(_dataExtractor.ExtractSeries(loadedLaps, _filters, "Throttle - 100%", ColorMap[4]));

            ScatterPlotChartViewModel viewModel = new ScatterPlotChartViewModel()
            {
                Title = "Lateral / Longitudinal G"
            };

            viewModel.FromModel(scatterPlot);

            return(viewModel);
        }
        private IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForAllStints(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping)
        {
            IColorPaletteProvider            colorPaletteProvider = new BasicColorPaletteProvider();
            List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>();
            IEnumerable <IGrouping <int, LapTelemetryDto> > lapsInStints = lapsStintGrouping as IGrouping <int, LapTelemetryDto>[] ?? lapsStintGrouping.ToArray();

            string title = BuildTitleForAllStints(lapsInStints);
            double maxG  = 0;

            AxisDefinition xAxis       = new AxisDefinition(_dataExtractor.XMajorTickSize, _dataExtractor.XMajorTickSize / 4, _dataExtractor.XUnit, "Lat Acc");
            AxisDefinition yAxis       = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit, "Long Acc");
            ScatterPlot    scatterPlot = new ScatterPlot(title, xAxis, yAxis);

            foreach (IGrouping <int, LapTelemetryDto> lapsInStint in lapsInStints)
            {
                string            seriesTitle = $"Laps: {string.Join(", ", lapsInStint.Select(x => x.LapSummary.CustomDisplayName))} - Stint: {lapsInStint.Key}";
                ScatterPlotSeries newSeries   = _dataExtractor.ExtractSeries(lapsInStint, Enumerable.Empty <ITelemetryFilter>().ToList(), seriesTitle, colorPaletteProvider.GetNext().ToOxyColor());
                scatterPlot.AddScatterPlotSeries(newSeries);
                maxG = Math.Max(maxG, newSeries.DataPoints.Max(x => Math.Abs(x.Y)));
            }

            SetAxisRanges(maxG, xAxis, yAxis);
            ScatterPlotChartViewModel viewModel = new ScatterPlotChartViewModel(_dataPointSelectionSynchronization)
            {
                Title = "Lateral / Longitudinal G"
            };

            viewModel.FromModel(scatterPlot);
            charts.Add(viewModel);
            return(charts);
        }