Binding an observable collection

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
n0kx
Posts: 8
Joined: Mon Apr 27, 2015 7:14 pm

Binding an observable collection

Post by n0kx » Thu May 07, 2015 8:12 pm

I used an observable collection on a previous charting library and I'm trying to do the same with LightningCharts but I'm having a hard time finding the right calls.

Here is what I had that worked...

Code: Select all

MyDataCollection dataCollection = new MyDataCollection();

chart.DataContext = dataCollection;
((CategoryXAxis)chart.Axes[0]).ItemsSource = dataCollection;
((LineSeries)chart.Series[0]).ItemsSource = dataCollection;
I'm trying this but no luck and I'm sure I need to do something similar to .ItemSource like above, but I'm not sure what to use.

Code: Select all

MyDataCollection dataCollection = new MyDataCollection();

chart.BeginUpdate();

chart.DataContext = dataCollection;

// Not sure what to do here, but this doesn't work
// chart.ViewXY.SampleDataSeries[0].AddSamples(dataCollection, false);

chart.EndUpdate();
Any suggestions? Thanks!

ArctionJari

Re: Binding an observable collection

Post by ArctionJari » Fri May 08, 2015 8:55 am

Our chart does not currently support data binding. We are working on this and data binding will be included in version 7. Estimated delivery is by the end of this year.

Until then, you need to add data “manually” using methods that each series have. For example, in PointLineSeries there is AddPoints method and in SampleDataSeries there is AddSamples method. Take a look at the examples in our WPF demo application - especially the first ones under "Basic" and "Real-time monitoring". I also sent you some details in email.

Post Reply