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 }); }
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); }
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); }