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);
        }
        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);
        }
        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 });
        }
        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> 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);
        }
        protected ScatterPlot CreateScatterPlot(IReadOnlyCollection <LapTelemetryDto> loadedLaps, int gear)
        {
            AxisDefinition xAxis       = new AxisDefinition(_rpmToHorizontalGExtractor.XMajorTickSize, _rpmToHorizontalGExtractor.XMajorTickSize / 4, _rpmToHorizontalGExtractor.XUnit);
            AxisDefinition yAxis       = new AxisDefinition(_rpmToHorizontalGExtractor.YMajorTickSize, _rpmToHorizontalGExtractor.YMajorTickSize / 4, _rpmToHorizontalGExtractor.YUnit);
            ScatterPlot    scatterPlot = new ScatterPlot($"Gear: {gear}", xAxis, yAxis);

            scatterPlot.AddScatterPlotSeries(_rpmToHorizontalGExtractor.ExtractSeriesForGear(loadedLaps, gear.ToString()));
            return(scatterPlot);
        }
        protected ScatterPlot CreateScatterPlot(IEnumerable <LapTelemetryDto> loadedLaps, int gear)
        {
            AxisDefinition xAxis       = new AxisDefinition(_dataExtractor.XMajorTickSize, _dataExtractor.XMajorTickSize / 5, _dataExtractor.XUnit);
            AxisDefinition yAxis       = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit);
            ScatterPlot    scatterPlot = new ScatterPlot($"Gear: {gear}", xAxis, yAxis);

            scatterPlot.AddScatterPlotSeries(_dataExtractor.ExtractSeriesForGear(loadedLaps, gear.ToString()));
            return(scatterPlot);
        }
        protected ScatterPlot CreateScatterPlotAllGear(IReadOnlyCollection <LapTelemetryDto> loadedLaps, int maxGear)
        {
            AxisDefinition xAxis       = new AxisDefinition(_rpmToHorizontalGExtractor.XMajorTickSize, _rpmToHorizontalGExtractor.XMajorTickSize / 4, _rpmToHorizontalGExtractor.XUnit);
            AxisDefinition yAxis       = new AxisDefinition(_rpmToHorizontalGExtractor.YMajorTickSize, _rpmToHorizontalGExtractor.YMajorTickSize / 4, _rpmToHorizontalGExtractor.YUnit);
            ScatterPlot    scatterPlot = new ScatterPlot("All Gears", xAxis, yAxis);

            for (int i = 1; i <= maxGear; i++)
            {
                scatterPlot.AddScatterPlotSeries(_rpmToHorizontalGExtractor.ExtractSeriesForGear(loadedLaps, i.ToString()));
            }

            return(scatterPlot);
        }
        private ScatterPlot CreateScatterPlotAllGear(IGrouping <int, LapTelemetryDto>[] lapsInStints, int maxGear)
        {
            IColorPaletteProvider colorPaletteProvider = new BasicColorPaletteProvider();
            AxisDefinition        xAxis       = new AxisDefinition(_dataExtractor.XMajorTickSize, _dataExtractor.XMajorTickSize / 5, _dataExtractor.XUnit);
            AxisDefinition        yAxis       = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit);
            ScatterPlot           scatterPlot = new ScatterPlot("All Gears", xAxis, yAxis);

            foreach (IGrouping <int, LapTelemetryDto> stint in lapsInStints)
            {
                string seriesTitle = $"Laps: {string.Join(", ", stint.Select(x => x.LapSummary.CustomDisplayName))} - Stint: {stint.Key}";
                scatterPlot.AddScatterPlotSeries(_dataExtractor.ExtractSeriesForAllGears(stint, seriesTitle, colorPaletteProvider.GetNext().ToOxyColor()));
            }

            return(scatterPlot);
        }
Exemple #10
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(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 });
        }
Exemple #12
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);
        }