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
285
xamchart and viewmodel
posted

Hi,

i developing a application where temperature data from a device are shown in a line chart (I use ScatterLine diagram). The x-Axis should show the time values and the y-Axis the temperature values. I use the Microsoft Prism framework. I tried your example 'Binding xamChart to Data' with static values and it works well. But now I wanted to modifiy the data every second by an external thread which throws an exception via the IEventAggregator of the prism framework like i do it with other values which are shown in Textblocks too. To modifiy the data I only add the new data value pair to my existing ObservableCollection but nothing happend.

After this I tried it like described in your 'Modifying the underlaying data' example, I disabled and enabled the RefreshEnabled attribute but know it throws an exception that this is not the right thread ....!

 

How can I modify the chart by using an eventaggregator?

If I use a viewmodel constructor with a IUnitycontainer parameter your example with the static values did'nt work too. Only if I use a paremeterless constructor it works.

Parents
No Data
Reply
  • 30692
    Verified Answer
    Offline posted

    if you are changing properties of the chart from a different thread you need to marshal your interactions onto the UI thread by calling methods on the charts dispatcher. see: http://msdn.microsoft.com/en-us/magazine/cc163328.aspx

    As to the first question, you may want to ensure you are updating the observable collection on the UI thread also.

    If you can share a small example that illustrates the problem you are encountering, I can give you further pointers.

    -Graham

Children