This is a migrated thread and some comments may be shown as answers.

Real time data from non UI-Thread

2 Answers 48 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Eduardo
Top achievements
Rank 1
Eduardo asked on 30 Apr 2013, 02:45 PM
Hi,
I'm working on a App that is constantly getting live data, but I'm not sure how to bind this to a Chart. I obtain the data from a model class over a Non-UI thread. I tried creating an observable collection which is updated every time I get new data, but since the data is modified on a non-ui thread, I start getting some exceptions. I solved it by surrounding the code that adds data with a dispatcher call, but then result is not a fluid live chart, but one that update itself in steps.

Model:
ObservableCollection<Log> dataList;
  
  
private void onDataReceived(double receivedData)
{
Deployment.Current.Dispatcher.BeginInvoke( () => 
  dataList.add(new Log(receivedData)); 
);
}

Is there any other way of updating the ObservableCollection from a non-ui thread, that doesn't ?

Thank you

2 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 02 May 2013, 08:28 AM
Hello Eduardo,

Thanks for the question.
I am afraid that this is the only way to update the UI thread without causing cross thread exceptions. Dispatcher is the only API that Silverlight provides.

All the best,
Victor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Erquan
Top achievements
Rank 1
answered on 08 May 2013, 05:17 PM
Hi there, i saw your post said that you are working on app with constantly getting live data. Do you mind to share how you implement this? Is it something similar to Signalr Helper? 
Tags
Chart
Asked by
Eduardo
Top achievements
Rank 1
Answers by
Victor
Telerik team
Erquan
Top achievements
Rank 1
Share this question
or