Hello everyone my name is Genti and I am new in this forum, I am writing here because I need help regarding my project.
I want to use Infragistics charts for my project. My project consist on getting data from a sensor and they are dynamically updated. The data is displayed very well on gauges but now I want to display all data collected on a chart but I get only a blank page. Can anyone please help me, I am trying to using category chart.
Thank you.
Hello Genti,
I have been investigating into your requirement to use the category chart in this case, and I believe it is likely that the reason that your XamCategoryChart is not showing up could potentially be due to the data structure you are using – assuming that you have successfully bound the ItemsSource of the control and it is still showing up blank.
For a reference on how to bind data to the XamCategoryChart, I would recommend utilizing the following online documentation article: https://es.infragistics.com/help/wpf/categorychart-binding-to-data.
I hope this helps you. Please let me know if you have any other questions or concerns on this matter.
Hello Andrew, thank you for your response. I read the link that you suggest me and I tested the example and it works fine but the problem is that my code is more complicated and there have many differences between my code and the example. I am posting a part of my code here to get maybe a suggestion how to implement charts on my code.
Thanks.
public class BLEConncetViewModel : BindableBase { private INavigationService _navigationService; private IAdapter _btAdapter; private IDevice _btDevice;
private float _temperature; private float _humidity; private float _soil; private readonly List<int> dSensorList;
private List<DataSensor> _datasensor;
private List<DataSensor> DataSensor
{ get { return _datasensor; } set { _datasensor = value; RaisePropertyChanged(); } }
public float Temperature { get { return _temperature; } set { SetProperty(ref _temperature, value); } } public float Humidity { get { return _humidity; } set { SetProperty(ref _humidity, value); }
} public float Soil { get { return _soil; } set { SetProperty(ref _soil, value); }
}
private DataSensor dataSensor;
public ICommand OnClickCommand { get; set; }
private bool _isScanning;
public bool IsScanning { get { return _isScanning; } set { SetProperty(ref _isScanning, value); } }
private string _statusText;
public string StatusText { get { return _statusText; } set { SetProperty(ref _statusText, value); } } public BLEConncetViewModel(INavigationService navigationService, IAdapter btAdapter) { _navigationService = navigationService; _btAdapter = btAdapter; _btAdapter.DeviceDiscovered += OnDeviceDiscovered; OnClickCommand = new DelegateCommand(OnClick); }
private void OnDeviceDiscovered(object sender, DeviceEventArgs e) { if (!string.IsNullOrWhiteSpace(e.Device.Name) && e.Device.Name.Contains("GNHC-01S")) { _btDevice = e.Device; NavigationParameters p = new NavigationParameters { { "Device", _btDevice } };
_navigationService.NavigateAsync(new Uri(nameof(MainMenu), UriKind.Relative), p); } }
private async void OnClick() { IsScanning = !IsScanning;
if (_isScanning) { PermissionStatus status = PermissionStatus.Denied;
if (status != PermissionStatus.Granted) { var results = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Location);
//Check that the key exists and if so, assign it to status. if (results.ContainsKey(Permission.Location)) status = results[Permission.Location]; } await _btAdapter.StartScanningForDevicesAsync();