Drawing big plots

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
webadm
Newbie
Newbie
Posts: 9
Joined: Tue Jun 05, 2018 12:00 am

Drawing big plots

Post by webadm » Thu Apr 11, 2019 2:21 pm

I'm using TeeChart VLC with C++ Builder Pro Tokyo.

I have an application that has a lot of plots and sometimes with a lot of points. The applciation is very dynamic so the plots get redraw many times.

As far as I know VLC UI can only be updated via main thread, leaving to the main thread only the tasks to updated all the plots secuentially.

The machines where my application run are all high end multicore so my question is if there is a technique available that would allow me to do all the hard work of recreating a plot on a thread in the background (with maybe be a queue of a thread pool) while showing some kind of "Work in progress" bitmap or some kind of feedback to the user with a progress bar leaving the main thread free to keep processing other messages.

I'm already applying point reduction techniques but some plots cannot get advantage of that.

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

Re: Drawing big plots

Post by Yeray » Mon Apr 15, 2019 11:05 am

Hello,

I'm afraid TeeChart isn't thread-safe and updating visual controls from outside the main thread is not advisable as can be read here.
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

webadm
Newbie
Newbie
Posts: 9
Joined: Tue Jun 05, 2018 12:00 am

Re: Drawing big plots

Post by webadm » Mon Apr 15, 2019 1:11 pm

Ok .Thanks.

webadm
Newbie
Newbie
Posts: 9
Joined: Tue Jun 05, 2018 12:00 am

Re: Drawing big plots

Post by webadm » Mon Apr 15, 2019 1:54 pm

Idea for a new feature.

How dificult would be to add a feature like that

pseudo code from here:

TChart->BeginUpdateFromThred()
- TChart draw on GUI, and if something needs to be draw gets draw on a temporary Bitmatp
- User calls to Canvas methds draw on the temporary Bitmap
- Then TChart canvas renders a visual on the real canvas to indicate that graph has been recalculated on background
- we can update the Thcart and series here from a thread savely (it would be painted on the temp Bitmap)
TChart->EndUdpateFromThread()
The Bitmat gets finalized and gets transfered on the Real TChart canvas.

It is a kind of double buffer idea. It would be really nice for the user to not have the UI frozen... and to use all the hw resources available.

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

Re: Drawing big plots

Post by Yeray » Tue Apr 23, 2019 9:42 am

Hello,

I'm not sure if this is possible.
There seems to be quite a consensus in advising against it.

But you could give a try at the techniques described here and there.
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