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

            _lateralAccFilter.MinimumG = 0;
            _lateralAccFilter.MaximumG = double.MaxValue;
            foreach (IGrouping <int, LapTelemetryDto> lapsInStint in lapsInStints)
            {
                string            seriesTitle = BuildSeriesTitle(lapsInStint);
                ScatterPlotSeries newSeries   = _dataExtractor.ExtractSeries(lapsInStint, _filters, seriesTitle, colorPaletteProvider.GetNext().ToOxyColor());
                scatterPlot.AddScatterPlotSeries(newSeries);
            }

            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);
            return(new[] { viewModel });
        }
Exemplo n.º 5
0
        private ScatterPlotChartViewModel CreateScatterPlotChartViewModel(string title, params ScatterPlotSeries[] series)
        {
            ScatterPlot scatterPlot = new ScatterPlot(title, CreateXAxisDefinition(), CreateYAxisDefinition());

            series.ForEach(scatterPlot.AddScatterPlotSeries);

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

            viewModel.FromModel(scatterPlot);
            return(viewModel);
        }
        private ScatterPlotChartViewModel CreateScatterPlotChartViewModel(string title, params ScatterPlotSeries[] series)
        {
            ScatterPlot scatterPlot = new ScatterPlot(title, CreateXAxisDefinition(), CreateYAxisDefinition());

            scatterPlot.YAxis.SetCustomRange(-1, 1);
            series.ForEach(scatterPlot.AddScatterPlotSeries);

            ScatterPlotChartViewModel viewModel = new ScatterPlotChartViewModel(_dataPointSelectionSynchronization)
            {
                Title = title
            };

            viewModel.FromModel(scatterPlot);
            return(viewModel);
        }
Exemplo n.º 7
0
        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);
        }
        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);
        }
Exemplo n.º 9
0
        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);
            AxisDefinition yAxis       = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit);
            ScatterPlot    scatterPlot = new ScatterPlot(title, xAxis, yAxis);

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

            ScatterPlotChartViewModel viewModel = new ScatterPlotChartViewModel()
            {
                Title = "Downforce"
            };

            viewModel.FromModel(scatterPlot);

            return(viewModel);
        }
        private IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForAllStints(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping)
        {
            IGrouping <int, LapTelemetryDto>[] lapsInStints = lapsStintGrouping as IGrouping <int, LapTelemetryDto>[] ?? lapsStintGrouping.ToArray();
            string title   = BuildTitleForAllStints(lapsInStints);
            int    maxGear = lapsInStints.SelectMany(x => x).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(lapsInStints, maxGear));
            viewModel.MainAggregatedChartViewModel = mainViewModel;

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

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

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

            int maxGear = loadedLaps.SelectMany(x => x.TimedTelemetrySnapshots).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()
            {
                Title = "All Gear"
            };

            mainViewModel.FromModel(CreateScatterPlotAllGear(loadedLaps, maxGear));

            viewModel.MainAggregatedChartViewModel = mainViewModel;

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

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

            return(viewModel);
        }
        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> CreateChartForAllStints(ICollection <IGrouping <int, LapTelemetryDto> > lapsStintGrouping)
        {
            string         title       = BuildTitleForAllStints(lapsStintGrouping);
            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);

            IColorPaletteProvider colorPaletteProvider = new BasicColorPaletteProvider();

            foreach (IGrouping <int, LapTelemetryDto> lapsInStintGroup in lapsStintGrouping)
            {
                string seriesTitle = $"Laps: {string.Join(", ", lapsInStintGroup.Select(x => x.LapSummary.CustomDisplayName))} - Stint: {lapsInStintGroup.Key}";
                scatterPlot.AddScatterPlotSeries(_dataExtractor.ExtractSeries(lapsInStintGroup, Enumerable.Empty <ITelemetryFilter>().ToList(), seriesTitle, colorPaletteProvider.GetNext().ToOxyColor()));
            }

            ScatterPlotChartViewModel viewModel = new ScatterPlotChartViewModel(_dataPointSelectionSynchronization)
            {
                Title = ChartName
            };

            viewModel.FromModel(scatterPlot);
            return(new[] { viewModel });
        }
Exemplo n.º 14
0
        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, "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(loadedLaps, _filters, seriesTitle, ColorMap[i]);
                if (newSeries == null)
                {
                    continue;
                }

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

            viewModel.FromModel(scatterPlot);

            return(viewModel);
        }