private void OpenSelectedChart()
        {
            if (!(_chartSelectionWindow?.Content is IAggregatedChartSelectorViewModel viewModel))
            {
                return;
            }

            CancelAndCloseSelectionWindow();

            string providerName = viewModel.SelectedTabIndex == 0 ? viewModel.SelectedHistogramChartName : viewModel.SelectedScatterPlotChartName;

            if (string.IsNullOrWhiteSpace(providerName))
            {
                return;
            }

            IAggregatedChartProvider selectedProvider = _aggregatedChartProviders.FirstOrDefault(x => x.ChartName == providerName);

            if (selectedProvider == null)
            {
                return;
            }

            AggregatedChartSettingsDto aggregatedChartSettingsDto = viewModel.AggregatedChartSettingsViewModel.SaveToNewModel();

            _settingsController.TelemetrySettings.AggregatedChartSettings = aggregatedChartSettingsDto;
            IReadOnlyCollection <IAggregatedChartViewModel> chartViewModels = selectedProvider.CreateAggregatedChartViewModels(aggregatedChartSettingsDto);

            OpenAggregatedCharts(chartViewModels);
        }
 public abstract IReadOnlyCollection <IAggregatedChartViewModel> CreateAggregatedChartViewModels(AggregatedChartSettingsDto aggregatedChartSettings);
Exemple #3
0
        public override IReadOnlyCollection <IAggregatedChartViewModel> CreateAggregatedChartViewModels(AggregatedChartSettingsDto aggregatedChartSettings)
        {
            List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>();
            var groupedByStint = GetLapsGrouped(aggregatedChartSettings);

            foreach (IGrouping <int, LapTelemetryDto> lapsInStint in groupedByStint)
            {
                string title = BuildChartTitle(lapsInStint, aggregatedChartSettings);

                HistogramChartViewModel viewModel = _viewModelFactory.Create <HistogramChartViewModel>();
                viewModel.IsBandVisible  = true;
                viewModel.Title          = title;
                viewModel.Unit           = _speedHistogramExtractor.YUnit;
                viewModel.BandSize       = _speedHistogramExtractor.DefaultBandSize;
                viewModel.RefreshCommand = new RelayCommand(() => FillHistogramViewmodel(lapsInStint.ToList(), viewModel));
                FillHistogramViewmodel(lapsInStint.ToList(), viewModel);
                charts.Add(viewModel);
            }

            return(charts);
        }
Exemple #4
0
        public IReadOnlyCollection <IAggregatedChartViewModel> CreateAggregatedChartViewModels(AggregatedChartSettingsDto aggregatedChartSettings)
        {
            var histogramChartSettings = aggregatedChartSettings.StintRenderingKind == StintRenderingKind.SingleChart ? new AggregatedChartSettingsDto() : aggregatedChartSettings;
            var mainViewModels         = _latToLogGProvider.CreateAggregatedChartViewModels(aggregatedChartSettings).ToList();
            var speedInTurnsModels     = _speedInTurnsHistogramProvider.CreateAggregatedChartViewModels(histogramChartSettings).ToList();
            var latGViewModels         = _speedToLatGProvider.CreateAggregatedChartViewModels(aggregatedChartSettings).ToList();
            var longGViewModels        = _speedToLongGProvider.CreateAggregatedChartViewModels(aggregatedChartSettings).ToList();

            var compositeViewModels = new List <IAggregatedChartViewModel>();

            for (int i = 0; i < mainViewModels.Count; i++)
            {
                var newCompositeViewModel = new CompositeAggregatedChartsViewModel {
                    Title = mainViewModels[i].Title, MainAggregatedChartViewModel = mainViewModels[i]
                };
                if (i < speedInTurnsModels.Count)
                {
                    newCompositeViewModel.AddChildAggregatedChildViewModel(speedInTurnsModels[i]);
                }


                if (i < latGViewModels.Count)
                {
                    newCompositeViewModel.AddChildAggregatedChildViewModel(latGViewModels[i]);
                }

                if (i < longGViewModels.Count)
                {
                    newCompositeViewModel.AddChildAggregatedChildViewModel(longGViewModels[i]);
                }

                compositeViewModels.Add(newCompositeViewModel);
            }

            return(compositeViewModels);
        }
        public IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForEachStint(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping, AggregatedChartSettingsDto aggregatedChartSettings)
        {
            IColorPaletteProvider            colorPaletteProvider = new ColorRangePaletteProvider(FromColor, ToColor, ColorSteps);
            List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>();
            double throttleStep = 1.0 / (colorPaletteProvider.PaletteSize - 1);

            foreach (IGrouping <int, LapTelemetryDto> lapsGrouped in lapsStintGrouping)
            {
                string title = BuildChartTitle(lapsGrouped, aggregatedChartSettings);
                List <ScatterPlotSeries> leftFrontWheelSeries  = new List <ScatterPlotSeries>();
                List <ScatterPlotSeries> rightFrontWheelSeries = new List <ScatterPlotSeries>();
                List <ScatterPlotSeries> leftRearWheelSeries   = new List <ScatterPlotSeries>();
                List <ScatterPlotSeries> rightRearWheelSeries  = new List <ScatterPlotSeries>();

                colorPaletteProvider.Reset();

                OxyColor color;
                string   throttleLabel;
                string   seriesTitle;

                for (int i = 0; i < colorPaletteProvider.PaletteSize - 1; i++)
                {
                    color = colorPaletteProvider.GetNext().ToOxyColor();
                    _dataExtractor.ThrottlePositionFilter.Minimum = throttleStep * i;
                    _dataExtractor.ThrottlePositionFilter.Maximum = throttleStep * (i + 1);
                    throttleLabel = $"Throttle: {_dataExtractor.ThrottlePositionFilter.Minimum * 100:F0} - {_dataExtractor.ThrottlePositionFilter.Maximum * 100:F0}";
                    seriesTitle   = $"Stint: {lapsGrouped.Key} " + throttleLabel;

                    leftFrontWheelSeries.Add(_dataExtractor.ExtractFrontLeft(lapsGrouped, "FL :" + seriesTitle, color));
                    rightFrontWheelSeries.Add(_dataExtractor.ExtractFrontRight(lapsGrouped, "FR :" + seriesTitle, color));
                    leftRearWheelSeries.Add(_dataExtractor.ExtractRearLeft(lapsGrouped, "RL :" + seriesTitle, color));
                    rightRearWheelSeries.Add(_dataExtractor.ExtractRearRight(lapsGrouped, "RR :" + seriesTitle, color));
                }

                color = colorPaletteProvider.GetNext().ToOxyColor();
                _dataExtractor.ThrottlePositionFilter.Minimum = 1;
                _dataExtractor.ThrottlePositionFilter.Maximum = double.MaxValue;
                throttleLabel = $"Throttle: 100";
                seriesTitle   = $"Stint: {lapsGrouped.Key} " + throttleLabel;

                leftFrontWheelSeries.Add(_dataExtractor.ExtractFrontLeft(lapsGrouped, "FL :" + seriesTitle, color));
                rightFrontWheelSeries.Add(_dataExtractor.ExtractFrontRight(lapsGrouped, "FR :" + seriesTitle, color));
                leftRearWheelSeries.Add(_dataExtractor.ExtractRearLeft(lapsGrouped, "RL :" + seriesTitle, color));
                rightRearWheelSeries.Add(_dataExtractor.ExtractRearRight(lapsGrouped, "RR :" + seriesTitle, color));

                WheelsChartViewModel mainViewModel = new WheelsChartViewModel()
                {
                    Title = title,
                    FrontLeftChartViewModel  = CreateScatterPlotChartViewModel("Front Left", leftFrontWheelSeries.ToArray()),
                    FrontRightChartViewModel = CreateScatterPlotChartViewModel("Front Right", rightFrontWheelSeries.ToArray()),
                    RearLeftChartViewModel   = CreateScatterPlotChartViewModel("Rear Left", leftRearWheelSeries.ToArray()),
                    RearRightChartViewModel  = CreateScatterPlotChartViewModel("Rear Right", rightRearWheelSeries.ToArray())
                };

                charts.Add(mainViewModel);
            }

            return(charts);
        }
        public override IReadOnlyCollection <IAggregatedChartViewModel> CreateAggregatedChartViewModels(AggregatedChartSettingsDto aggregatedChartSettings)
        {
            _dataExtractor.BrakePositionFilter.Minimum = double.MinValue;
            _dataExtractor.BrakePositionFilter.Maximum = 0.001;
            IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping = GetLapsGrouped(aggregatedChartSettings);

            if (aggregatedChartSettings.StintRenderingKind == StintRenderingKind.SingleChart)
            {
                return(CreateChartForAllStints(lapsStintGrouping.ToList()));
            }
            else
            {
                return(CreateChartForEachStint(lapsStintGrouping, aggregatedChartSettings));
            }
        }
Exemple #7
0
        public override IReadOnlyCollection <IAggregatedChartViewModel> CreateAggregatedChartViewModels(AggregatedChartSettingsDto aggregatedChartSettings)
        {
            List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>();
            var groupedByStint = GetLapsGrouped(aggregatedChartSettings);

            foreach (IGrouping <int, LapTelemetryDto> lapsInStint in groupedByStint)
            {
                string title = BuildChartTitle(lapsInStint, aggregatedChartSettings);

                int maxGear = lapsInStint.SelectMany(x => x.DataPoints).Where(x => !string.IsNullOrWhiteSpace(x.PlayerData.CarInfo.CurrentGear) && x.PlayerData.CarInfo.CurrentGear != "R" && x.PlayerData.CarInfo.CurrentGear != "N").Max(x => int.Parse(x.PlayerData.CarInfo.CurrentGear));

                CompositeAggregatedChartsViewModel viewModel = new CompositeAggregatedChartsViewModel()
                {
                    Title = title
                };

                HistogramChartViewModel mainViewModel = _viewModelFactory.Create <HistogramChartViewModel>();
                mainViewModel.FromModel(CreateHistogramAllGears(lapsInStint, _rpmHistogramDataExtractor.DefaultBandSize));

                viewModel.MainAggregatedChartViewModel = mainViewModel;

                for (int i = 1; i <= maxGear; i++)
                {
                    Histogram histogram = CreateHistogram(lapsInStint, i, _rpmHistogramDataExtractor.DefaultBandSize);
                    if (histogram == null)
                    {
                        continue;
                    }

                    HistogramChartViewModel child = _viewModelFactory.Create <HistogramChartViewModel>();
                    child.FromModel(histogram);
                    viewModel.AddChildAggregatedChildViewModel(child);
                }
                charts.Add(viewModel);
            }

            return(charts);
        }
        private IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForEachStint(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping, AggregatedChartSettingsDto aggregatedChartSettings)
        {
            IColorPaletteProvider            colorPaletteProvider = new RedGreenGradientPalette();
            List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>();

            foreach (IGrouping <int, LapTelemetryDto> lapsInStint in lapsStintGrouping)
            {
                string            title       = BuildChartTitle(lapsInStint, aggregatedChartSettings);
                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);
                ScatterPlotSeries newSeries;
                double            throttlePortion = 1.0 / colorPaletteProvider.PaletteSize;

                for (int i = 0; i < colorPaletteProvider.PaletteSize - 1; i++)
                {
                    _throttlePositionFilter.Minimum = i * throttlePortion;
                    _throttlePositionFilter.Maximum = (i + 1) * throttlePortion;
                    string seriesTitle = $"Throttle - {i * throttlePortion * 100:F2}% - {(i + 1) * throttlePortion * 100:F2}%";
                    newSeries = _dataExtractor.ExtractSeries(lapsInStint, _filters, seriesTitle, colorPaletteProvider.GetNext().ToOxyColor());
                    if (newSeries == null)
                    {
                        continue;
                    }
                    scatterPlot.AddScatterPlotSeries(newSeries);
                    maxG = Math.Max(maxG, newSeries.DataPoints.Max(x => Math.Abs(x.Y)));
                }


                _throttlePositionFilter.Minimum = 1;
                _throttlePositionFilter.Maximum = double.MaxValue;
                newSeries = _dataExtractor.ExtractSeries(lapsInStint, _filters, "Throttle - 100%", colorPaletteProvider.GetNext().ToOxyColor());
                maxG      = Math.Max(maxG, newSeries.DataPoints.Max(x => Math.Abs(x.Y)));
                scatterPlot.AddScatterPlotSeries(newSeries);

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

            return(charts);
        }
        public override IReadOnlyCollection <IAggregatedChartViewModel> CreateAggregatedChartViewModels(AggregatedChartSettingsDto aggregatedChartSettings)
        {
            IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping = GetLapsGrouped(aggregatedChartSettings);

            if (aggregatedChartSettings.StintRenderingKind == StintRenderingKind.SingleChart)
            {
                return(CreateChartForAllStints(lapsStintGrouping.ToList()));
            }
            else
            {
                return(CreateChartForEachStint(lapsStintGrouping, aggregatedChartSettings));
            }
        }
        public IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForEachStint(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping, AggregatedChartSettingsDto aggregatedChartSettings)
        {
            List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>();

            foreach (IGrouping <int, LapTelemetryDto> lapsInStint in lapsStintGrouping)
            {
                string         title       = BuildChartTitle(lapsInStint, aggregatedChartSettings);
                AxisDefinition xAxis       = new AxisDefinition(_dataExtractor.XMajorTickSize, _dataExtractor.XMajorTickSize / 4, _dataExtractor.XUnit, "Rear Roll Angle");
                AxisDefinition yAxis       = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit, "Front Roll Angle");
                ScatterPlot    scatterPlot = new ScatterPlot(title, xAxis, yAxis);

                for (int i = 0; i < ColorMap.Count; i++)
                {
                    double minG = i * 0.25;
                    double maxG = i + 1 == ColorMap.Count ? double.MaxValue : (i + 1) * 0.25;
                    _lateralAccFilter.MinimumG = minG;
                    _lateralAccFilter.MaximumG = maxG;
                    string            seriesTitle = maxG < double.MaxValue ? $"{minG:F2}G - {maxG:F2}G" : $"{minG:F2}G+";
                    ScatterPlotSeries newSeries   = _dataExtractor.ExtractSeries(lapsInStint, _filters, seriesTitle, ColorMap[i]);
                    if (newSeries == null)
                    {
                        continue;
                    }
                }

                scatterPlot.AddAnnotation(new LineAnnotation()
                {
                    Slope = 1, Intercept = 0, Color = OxyColors.Red, StrokeThickness = 1, LineStyle = LineStyle.Solid
                });
                ScatterPlotChartViewModel viewModel = new ScatterPlotChartViewModel(_dataPointSelectionSynchronization)
                {
                    Title = title
                };
                viewModel.FromModel(scatterPlot);
                charts.Add(viewModel);
            }

            return(charts);
        }
        private IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForEachStint(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping, AggregatedChartSettingsDto aggregatedChartSettings)
        {
            List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>();

            foreach (IGrouping <int, LapTelemetryDto> lapsGrouped in lapsStintGrouping)
            {
                string title = BuildChartTitle(lapsGrouped, aggregatedChartSettings);

                int maxGear = lapsGrouped.SelectMany(x => x.DataPoints).Where(x => !string.IsNullOrWhiteSpace(x.PlayerData.CarInfo.CurrentGear) && x.PlayerData.CarInfo.CurrentGear != "R" && x.PlayerData.CarInfo.CurrentGear != "N").Max(x => int.Parse(x.PlayerData.CarInfo.CurrentGear));

                CompositeAggregatedChartsViewModel viewModel = new CompositeAggregatedChartsViewModel()
                {
                    Title = title
                };

                ScatterPlotChartViewModel mainViewModel = new ScatterPlotChartViewModel(_dataPointSelectionSynchronization)
                {
                    Title = "All Gear"
                };
                mainViewModel.FromModel(CreateScatterPlotAllGear(lapsGrouped, maxGear));

                viewModel.MainAggregatedChartViewModel = mainViewModel;

                for (int i = 1; i <= maxGear; i++)
                {
                    ScatterPlot scatterPlot = CreateScatterPlot(lapsGrouped, i);
                    if (scatterPlot.ScatterPlotSeries.Count == 0)
                    {
                        continue;
                    }

                    ScatterPlotChartViewModel child = new ScatterPlotChartViewModel(_dataPointSelectionSynchronization)
                    {
                        Title = $"Gear {i}"
                    };
                    child.FromModel(scatterPlot);
                    viewModel.AddChildAggregatedChildViewModel(child);
                }

                charts.Add(viewModel);
            }

            return(charts);
        }
Exemple #12
0
        protected IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForEachStint(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping, AggregatedChartSettingsDto aggregatedChartSettings)
        {
            List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>();

            foreach (IGrouping <int, LapTelemetryDto> lapsInStintGroup in lapsStintGrouping)
            {
                string title = BuildSeriesTitle(lapsInStintGroup, aggregatedChartSettings);

                AxisDefinition    xAxis       = new AxisDefinition(_y1AxisDataExtractor.XMajorTickSize, _y1AxisDataExtractor.XMajorTickSize / 4, _y1AxisDataExtractor.XUnit);
                AxisDefinition    y1Axis      = new AxisDefinition(_y1AxisDataExtractor.YMajorTickSize, _y1AxisDataExtractor.YMajorTickSize / 4, _y1AxisDataExtractor.YUnit);
                AxisDefinition    y2Axis      = new AxisDefinition(_y2AxisDataExtractor.YMajorTickSize, _y2AxisDataExtractor.YMajorTickSize / 4, _y2AxisDataExtractor.YUnit);
                ScatterPlot2YAxis scatterPlot = new ScatterPlot2YAxis(title, xAxis, y1Axis, y2Axis);

                scatterPlot.AddScatterPlotSeries(_y1AxisDataExtractor.ExtractSeries(lapsInStintGroup, _filters, Y1Title + "-" + title, OxyColors.Green));
                scatterPlot.AddScatterPlotY2Series(_y2AxisDataExtractor.ExtractSeries(lapsInStintGroup, _filters, Y2Title + "-" + title, OxyColors.Red));
                OnNewScatterPlot(scatterPlot);
                ScatterPlot2YAxisChartViewModel viewModel = new ScatterPlot2YAxisChartViewModel()
                {
                    Title = ChartName
                };
                viewModel.FromModel(scatterPlot);
                charts.Add(viewModel);
            }

            return(charts);
        }
        public override IReadOnlyCollection <IAggregatedChartViewModel> CreateAggregatedChartViewModels(AggregatedChartSettingsDto aggregatedChartSettings)
        {
            List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>();
            var groupedByStint = GetLapsGrouped(aggregatedChartSettings);

            foreach (IGrouping <int, LapTelemetryDto> lapsInStint in groupedByStint)
            {
                string title = BuildChartTitle(lapsInStint, aggregatedChartSettings);

                T wheelsHistogram = _viewModelFactory.Create <T>();

                wheelsHistogram.Title    = title;
                wheelsHistogram.BandSize = AbstractWheelHistogramDataExtractor.DefaultBandSize;
                wheelsHistogram.Unit     = AbstractWheelHistogramDataExtractor.YUnit;

                TX flViewModel = _viewModelFactory.Create <TX>();
                TX frViewModel = _viewModelFactory.Create <TX>();
                TX rlViewModel = _viewModelFactory.Create <TX>();
                TX rrViewModel = _viewModelFactory.Create <TX>();

                wheelsHistogram.FrontLeftChartViewModel  = flViewModel;
                wheelsHistogram.FrontRightChartViewModel = frViewModel;
                wheelsHistogram.RearLeftChartViewModel   = rlViewModel;
                wheelsHistogram.RearRightChartViewModel  = rrViewModel;

                OnNewViewModel(wheelsHistogram);
                wheelsHistogram.RefreshCommand                  = new RelayCommand(() => RefreshHistogram(lapsInStint.ToList(), wheelsHistogram.BandSize, wheelsHistogram));
                wheelsHistogram.ResetParametersCommand          = new RelayCommand(() => ResetHistogramParameters(lapsInStint.ToList(), wheelsHistogram.BandSize, wheelsHistogram));
                wheelsHistogram.IsResetParametersCommandVisible = ResetCommandVisible;


                FillHistogramViewmodel(lapsInStint.ToList(), AbstractWheelHistogramDataExtractor.DefaultBandSize, wheelsHistogram);

                charts.Add(wheelsHistogram);
            }

            return(charts);
        }
 protected IEnumerable <IGrouping <int, LapTelemetryDto> > GetLapsGrouped(AggregatedChartSettingsDto aggregatedChartSettingsDto)
 {
     return(aggregatedChartSettingsDto.StintRenderingKind == StintRenderingKind.None ? _loadedLapsCache.LoadedLaps.GroupBy(x => 0) : _loadedLapsCache.LoadedLaps.GroupBy(x => x.LapSummary.Stint));
 }
        protected IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForEachStint(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping, AggregatedChartSettingsDto aggregatedChartSettings)
        {
            List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>();

            foreach (IGrouping <int, LapTelemetryDto> lapsInStintGroup in lapsStintGrouping)
            {
                string title = BuildChartTitle(lapsInStintGroup, aggregatedChartSettings);

                AxisDefinition xAxis       = new AxisDefinition(_dataExtractor.XMajorTickSize, _dataExtractor.XMajorTickSize / 4, _dataExtractor.XUnit);
                AxisDefinition yAxis       = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit);
                ScatterPlot    scatterPlot = new ScatterPlot(title, xAxis, yAxis)
                {
                    IsLegendVisible = IsLegendVisible
                };

                scatterPlot.AddScatterPlotSeries(_dataExtractor.ExtractSeries(lapsInStintGroup, Enumerable.Empty <ITelemetryFilter>().ToList(), title, OxyColors.Green));

                ScatterPlotChartViewModel viewModel = new ScatterPlotChartViewModel(_dataPointSelectionSynchronization)
                {
                    Title = ChartName
                };
                viewModel.FromModel(scatterPlot);
                charts.Add(viewModel);
            }

            return(charts);
        }
 protected string BuildSeriesTitle(IGrouping <int, LapTelemetryDto> lapGrouping, AggregatedChartSettingsDto aggregatedChartSettings)
 {
     if (aggregatedChartSettings.StintRenderingKind == StintRenderingKind.None)
     {
         return($"Laps: {string.Join(", ", lapGrouping.Select(x => x.LapSummary.CustomDisplayName))}");
     }
     else
     {
         return($"Laps: {string.Join(", ", lapGrouping.Select(x => x.LapSummary.CustomDisplayName))} - Stint: {lapGrouping.Key}");
     }
 }
Exemple #17
0
        public IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForEachStint(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping, AggregatedChartSettingsDto aggregatedChartSettings)
        {
            List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>();

            foreach (IGrouping <int, LapTelemetryDto> lapsGrouped in lapsStintGrouping)
            {
                string            title            = BuildChartTitle(lapsGrouped, aggregatedChartSettings);
                ScatterPlotSeries frontLeftSeries  = _dataExtractor.ExtractFrontLeft(lapsGrouped);
                ScatterPlotSeries frontRightSeries = _dataExtractor.ExtractFrontRight(lapsGrouped);
                ScatterPlotSeries rearLeftSeries   = _dataExtractor.ExtractRearLeft(lapsGrouped);
                ScatterPlotSeries rearRightSeries  = _dataExtractor.ExtractRearRight(lapsGrouped);

                SplitAggregatedChartViewModel mainViewModel = new SplitAggregatedChartViewModel()
                {
                    Title           = title,
                    TopViewModel    = CreateScatterPlotChartViewModel("All Wheels", frontLeftSeries, frontRightSeries, rearLeftSeries, rearRightSeries),
                    BottomViewModel = CreateWheelsChartViewModel(frontLeftSeries, frontRightSeries, rearLeftSeries, rearRightSeries)
                };
                charts.Add(mainViewModel);
            }

            return(charts);
        }