Hi,
In my ViewModel I have an ObservableCollection of ObervableCollection<DataEntry>. Each DataEntry is a point that has a Date (X axis) and Value (for its Y axis). I want a common Date X axis on the chart, and each collection of DataEntries can use a shared Y axis.
Any ideas how to bind this in XAML,or in code?
In my Model:
public partial class DataEntry { public int DataEntryId { get; set; } public System.DateTime Date { get; set; } public double Value { get; set; } public int CoreId { get; set; } public virtual Core Core { get; set; } }
In my ViewModel, the property I want to bind too:
private ObservableCollection<ObservableCollection<DataEntry>> _sensorData; public ObservableCollection<ObservableCollection<DataEntry>> SensorData { get { return _sensorData; } set { _sensorData = value; NotifyPropertyChanged("SensorData"); } }
Each collection should have its own ScatterLineSeries right?
If I add a new collection, or remove one from the SensorData collection I would like the chart to automatically update to show it. They're populated from a BackgroundWorker thread.
Thanks
Chunda
Hello Chunda,
Thank you for your post. I have been looking into it and I can suggest you see these two forum threads:
http://ko.infragistics.com/community/forums/t/75026.aspx
and
http://ko.infragistics.com/community/forums/t/71286.aspx
where similar questions are already discussed. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
Thanks yes those links helped.
Is there a simple way to do the binding in XAML, or is it best just to do the binding of the axes and data in some code behind, and update it when the selection changes of which axes we want to show?
Cheers
Paul
Hello Paul,
For the moment the best approaches are the ones I shared with you in my previous post. If I think of a better one I will let you know.