public PositionEstimationPage(Locale locale) { InitializeComponent(); var serviceProvider = Startup.ServiceProvider; this.wifiConnector = serviceProvider.GetService <IWifiConnector>(); this.bluetoothConnector = serviceProvider.GetService <IBluetoothConnector>(); this.magneticFieldSensor = serviceProvider.GetService <MagneticFieldSensor>(); this.positionEstimationService = serviceProvider.GetService <IPositionEstimationService>(); this.positionsService = serviceProvider.GetService <IPositionService>(); this.configuration = serviceProvider.GetService <Configuration>(); this.Locale = locale; PositionSignalDataCollection.ItemsSource = PositionSignalData; BindingContext = this; timer = new Timer(configuration.DataAquisitionInterval * 1000); timer.Elapsed += UpdateMonitoringState; timer.Start(); var positions = new List <Position>(); Locale.Zones?.ForEach(zone => positions.AddRange(zone.Positions)); chart = ChartsFactory.CreatePositionSignalDataScatterChart(AppResources.Current_locale, "", "", positions, "X", "Y", showError: false, markerLabel: "Id", height: 1200 + ((int)Math.Floor(positions.Count / 2.0) * 30)); chartStack.Children.Add(chart); }
private SfChart GeneratePositionsMagneticFieldChart() { var magneticFieldData = LocaleData.Where(data => data.SignalType == SignalType.Magnetometer).ToList(); MagneticFieldData = new ObservableCollection <PositionSignalData>(magneticFieldData); return(ChartsFactory.CreatePositionSignalDataScatterChart( AppResources.Magnetic_field, AppResources.Magnetic_Y_Intensity, AppResources.Magnetic_Z_Intensity, MagneticFieldData, "Z", "Y", "StandardDeviationZ", "StandardDeviationX", ErrorBarMode.Both )); }
private void AddPositionsSignalsCharts(StackLayout stackLayout) { SignalNames.ForEach(signalName => { var signalData = LocaleData.Where(data => data.SignalId == signalName).ToList(); var minimum = signalData.Min(signalData => signalData.Strength - signalData.StandardDeviation); var maximum = signalData.Max(signalData => signalData.Strength + signalData.StandardDeviation); var primaryAxis = new CategoryAxis() { Title = new ChartAxisTitle() { Text = AppResources.Position } }; var secondaryAxis = new NumericalAxis() { Minimum = minimum, Maximum = maximum, LabelStyle = new ChartAxisLabelStyle() { LabelFormat = "##" }, Title = new ChartAxisTitle() { Text = AppResources.RSSI_dB } }; var chart = ChartsFactory.CreatePositionSignalDataScatterChart( signalName, AppResources.RSSI_dB, AppResources.Position, signalData, "PositionId", "Strength", "", "StandardDeviation", ErrorBarMode.Vertical, primaryAxis, secondaryAxis, height: 400 + ((int)Math.Floor(signalData.Count / 2.0) * 30)); stackLayout.Children.Add(chart); }); }