/// <summary> /// Rysuje wykres dla wybranych danych /// </summary> /// <param name="obj"></param> private void DrawChart(object obj) { if (WindValuesChanged) { ClearPlot(); } WindDirection = AvailableWindDirection; WindSpeed = AvailableWindSpeed; WindValuesChanged = false; IsDataChanged = false; var listToInterpolate = new List <PointD>(); if (!AllRecords) { DataCollection = new ObservableCollection <DataGps>(DataCollection.Where(x => x.WindSpeed == WindSpeed && x.WindDirection == WindDirection)); } foreach (var x in DataCollection) { double pointX = Math.Cos((90 - x.BoatDirection) / (180 / Math.PI)) * x.BoatSpeed; double pointY = Math.Sin((90 - x.BoatDirection) / (180 / Math.PI)) * x.BoatSpeed; listToInterpolate.Add(new PointD(pointX, pointY)); FindMinMaxAxis(listToInterpolate); } listToInterpolate = new List <PointD>(SplineInterpolation.FitGeometric(listToInterpolate)); ChartViewModel.AddNewSeries(listToInterpolate, BoatsCollection, SelectedIndexBoat, SessionCollection, SelectedIndexSession, _minX, _maxX, _minY, _maxY, AvailableWindSpeed, AvailableWindDirection, AllRecords, _isDataFromExcel); if (_isDataFromExcel) { DataCollection = new ObservableCollection <DataGps>(ExcelDataCollection); } else { GetData(); } }
public MainWindowViewModel() { ChartViewModel = new ChartViewModel(); ImportExcelDataCommand = new ActionCommand(ImportExcel); SaveToExcelCommand = new ActionCommand(SaveExcel); DrawPlotCommand = new RelayCommand(DrawChart, CheckDataComplete); ClearPlotCommand = new ActionCommand(ClearPlot); GetBoatsCommand = new ActionCommand(GetBoats); AcceptDataCommand = new RelayCommand(AcceptData, DataComplete); RefreshDataCommand = new ActionCommand(RefreshData); SaveToPdfCommand = new ActionCommand(SaveToPdf); GetBoats(); SelectedIndexBoat = 0; GetStartEndDates(); GetSessions(); GetData(); IsDataChanged = true; InitiateAxisValues(); }
public MainWindowViewModel() { ChartViewModel = new ChartViewModel(); ImportExcelDataCommand = new ActionCommand(ImportExcel); SaveToExcelCommand = new ActionCommand(SaveExcel); DrawPlotCommand = new RelayCommand(DrawChart, CheckDataComplete); ClearPlotCommand = new ActionCommand(ClearPlot); GetBoatsCommand = new ActionCommand(GetBoats); AcceptDataCommand = new RelayCommand(AcceptData, DataComplete); RefreshDataCommand = new ActionCommand(RefreshData); SaveToPdfCommand = new ActionCommand(SaveToPdf); GetBoats(); SelectedIndexBoat = 0; GetStartEndDates(); GetSessions(); GetData(); IsDataChanged = true; InitiateAxisValues(); }
/// <summary> /// Usuwa wykres /// </summary> private void ClearPlot() { ChartViewModel = new ChartViewModel(); }
/// <summary> /// Usuwa wykres /// </summary> private void ClearPlot() { ChartViewModel = new ChartViewModel(); }