views:

190

answers:

1

Hi,

I am working in WPF, using a Media Element and a WPF TeeChart (by Steema). Both of these are visible and updating at the same time - whilst the video is playing, the graph will update at regular intervals to show data relevant to the current location in the video.

The problem is that the TeeChart takes a long time to update, which blocks the video thus causing the playback to become jerky.

I have experimented a little with multithreading to try to find a solution for this, but so far have had no luck. I cannot dictate when either the video or the chart updates, in fact I suspect WPF works in such a way that any WPF elements are always drawn together.

Can anybody think of anything I can do to resolve this issue? At the moment all I can think of is replacing one or both of these elements with a Win32 equivalent and hosting it appropriately, but for numerous reasons I am leaving this as a last resort.

A: 

Hello,

Just in case you still haven't solved that issue or for future reference, you can optimize TeeChart's performance as described in the "Real-time Charting" article here:

http://www.teechart.net/reference/articles/index.php

This is a TeeChart VCL article but most of it also applies to TeeChart for .NET

Also notice that TeeChart for .NET is not thread safe. You need to give enough time to the chart to paint itself. You can either do this using a a sleep call so that the chart painting finishes in the given time or use asynchronous painting technique with AutoRepaint property, for example:

tChart1.AutoRepaint = false;
Random r = new Random();
for(int i = 0; i <500; i++)
{
      tChart1[0].Add (i,r.Next(800),Color.Blue);
}
tChart1.AutoRepaint = true;
tChart1.Refresh();
Narcís Calvet