TeeChart v8 and multithreading

TeeChart for ActiveX, COM and ASP
Post Reply
jhameenniemi
Newbie
Newbie
Posts: 2
Joined: Wed Nov 07, 2007 12:00 am

TeeChart v8 and multithreading

Post by jhameenniemi » Fri Dec 07, 2012 11:06 am

In this forum it has been made clear that TeeChart is not thread safe in a sense that data in series or TeeChart cannot be updated from other threads if TeeChart is being drawn.

Is it possible and safe however to update data in series and add new series from multiple threads if TeeChart is not being drawn i.e. automatic drawing is disabled and drawing is requested by client code? Is TeeChart’s series object container class access thread safe f.ex. by using critical sections in TeeChart code? I am aware that handling series removal from TeeChart if multiple threads are running is a bit of a challenge for client code because series’ indexes may change as a result but if we dismiss that and assume that adding a new series to TeeChart is not changing existing series’ indexes i.e. new series are always added to the tail of the TeeChart’s series object container class, is this scenario possible?

We are using TeeChart Pro v8 ActiveX control.

Yeray
Site Admin
Site Admin
Posts: 9587
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeeChart v8 and multithreading

Post by Yeray » Mon Dec 10, 2012 10:24 am

Hello,

Yes, disabling the AutoRepaint feature you can use semaphores (or any other threading technique) to safely add points or series in a thread, and repaint the chart in another thread. You just have to make sure both actions won't be made at the same time.
Don't hesitate to let us know if you find any problem implementing it.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

jhameenniemi
Newbie
Newbie
Posts: 2
Joined: Wed Nov 07, 2007 12:00 am

Re: TeeChart v8 and multithreading

Post by jhameenniemi » Tue Dec 11, 2012 7:04 am

Thank you for the information. One additional question: is it safe to add points to different series from multiple worker threads simultaneously if the painting is disabled?
We are planning to create a thread pool where each thread adds points to a single series to speed up the graph updating for large amounts of data.

Yeray
Site Admin
Site Admin
Posts: 9587
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeeChart v8 and multithreading

Post by Yeray » Tue Dec 11, 2012 10:34 am

Hello,
jhameenniemi wrote:is it safe to add points to different series from multiple worker threads simultaneously if the painting is disabled?
I think it should. In general, different series don't have relations between them.
Only the functions are linked to a series, which at the same time are linked to source series.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply