Exemplo n.º 1
0
        public IAggregatedChartViewModel CreateAggregatedChartViewModel()
        {
            IReadOnlyCollection <LapTelemetryDto> loadedLaps = _loadedLaps.LoadedLaps;
            string            title            = $"{ChartName} - Laps: {string.Join(", ", loadedLaps.Select(x => x.LapSummary.CustomDisplayName))}";
            ScatterPlotSeries frontLeftSeries  = _dataExtractor.ExtractFrontLeft(loadedLaps);
            ScatterPlotSeries frontRightSeries = _dataExtractor.ExtractFrontRight(loadedLaps);
            ScatterPlotSeries rearLeftSeries   = _dataExtractor.ExtractRearLeft(loadedLaps);
            ScatterPlotSeries rearRightSeries  = _dataExtractor.ExtractRearRight(loadedLaps);

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

            return(mainViewModel);
        }
Exemplo n.º 2
0
        private IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForAllStints(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping)
        {
            IColorPaletteProvider colorPaletteProvider = new BasicColorPaletteProvider();
            var    lapsInStints = lapsStintGrouping as IGrouping <int, LapTelemetryDto>[] ?? lapsStintGrouping.ToArray();
            string title        = BuildTitleForAllStints(lapsInStints);

            List <ScatterPlotSeries> allWheelsSeries       = new List <ScatterPlotSeries>();
            List <ScatterPlotSeries> leftFrontWheelSeries  = new List <ScatterPlotSeries>();
            List <ScatterPlotSeries> rightFrontWheelSeries = new List <ScatterPlotSeries>();
            List <ScatterPlotSeries> leftRearWheelSeries   = new List <ScatterPlotSeries>();
            List <ScatterPlotSeries> rightRearWheelSeries  = new List <ScatterPlotSeries>();

            foreach (IGrouping <int, LapTelemetryDto> lapsGrouped in lapsInStints)
            {
                OxyColor color       = colorPaletteProvider.GetNext().ToOxyColor();
                string   seriesTitle = $"Laps: {string.Join(", ", lapsGrouped.Select(x => x.LapSummary.CustomDisplayName))} - Stint: {lapsGrouped.Key}";
                allWheelsSeries.Add(_dataExtractor.ExtractMultiPointSeries(lapsGrouped, new ITelemetryFilter[0], "All" + seriesTitle, color));
                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));
            }

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

            return(new[] { mainViewModel });
        }
Exemplo n.º 3
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);
        }