Page 1 of 1

Drawing big plots

Posted: Thu Apr 11, 2019 2:21 pm
by 16583777
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.

Re: Drawing big plots

Posted: Mon Apr 15, 2019 11:05 am
by yeray
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.

Re: Drawing big plots

Posted: Mon Apr 15, 2019 1:11 pm
by 16583777
Ok .Thanks.

Re: Drawing big plots

Posted: Mon Apr 15, 2019 1:54 pm
by 16583777
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.

Re: Drawing big plots

Posted: Tue Apr 23, 2019 9:42 am
by yeray
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.