Main UI app freeze when I try generation of a set of bitmap images from the chart content by using Headless Rendering

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

chistyk
Posts: 1
Joined: Fri Jul 31, 2020 3:14 pm

Main UI app freeze when I try generation of a set of bitmap images from the chart content by using Headless Rendering

Post by chistyk » Tue May 04, 2021 1:44 pm

I have two charts on the main screen and I want to generate a set of images from the booth of charts in the background mode, show the user the waiting popup. When I run the process main UI not responding. I don't want the to user see this freeze. Could you give me some advice on the better way to implement what I want?
Please find my sample app.
Thank you for any help.
Attachments
WpfTaskChart.zip
(61.35 KiB) Downloaded 55 times

ArctionKestutis
Posts: 411
Joined: Mon Mar 14, 2016 9:22 am

Re: Main UI app freeze when I try generation of a set of bitmap images from the chart content by using Headless Renderin

Post by ArctionKestutis » Fri May 14, 2021 2:05 pm

Sample application is a little bit confusing and I don't have DevExpress libraries to debug it properly.
Here will just outline things you should take care or be aware.
Normal Chart should be rendered (properties modified in main UI Thread). You can do the thick by creating several window in application with its own thread, and add chart to each of them. This is demonstrated in project/topic here.
In contrast, LightningChart in Headless mode (as you are trying to use) could be rendered in background thread. It is only important that Headless chart should be updated in the same thread it was created. It seems to me that LCRunner.GenerateImages() method is using application main UI Thread. Therefore, there is no benefit of using Parallel loops and Task.Factory.
Hope this helps.