Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
xamDataChart bind to ObservableCollection of ObservableCollections, one for each ScatterLineSeries with common X & Y axis?
posted

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

Parents
No Data
Reply Children