Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
RenderPdfFriendlyGraphics method freezes the UI thread
posted

I need to generate a report with a chart. I use UltraChart and the RenderPdfFriendlyGraphics method to get the image. RenderPdfFriendlyGraphics takes more than 6 minutes to execute because I have a lot of data. In order to make my application responsive I decided to generate the report in a separate thread, different from the UI thread. However, this didn't solve the problem. When RenderPdfFriendlyGraphics is executed, the UI freezes.
1. Does RenderPdfFriendlyGraphics access the UI thread (make it active)?
2. Could you suggest how to avoid the UI thread freezing (for example, so that the time elapsed since the start of the report generation could be updated in a form label)?

Parents
  • 2700
    Offline posted

    Hello Alexander,

    Thank you for contacting Infragistics Developer Support!

    I have been looking into your question and while I am not familiar with the amount and type of data that your chart is displaying, I have tested the UltraChart on my side with a large amount of data records and it does appear to handle numbers in the scope of ten thousands of records not as smoothly. Regarding techniques to execute the report generation asynchronously, I am afraid the RenderPdfFriendlyGraphics would be a black box here, and any additional handling should happen on application level. Furthermore, I would be curious if you aren’t observing any performance downgrades apart from the PDF exporting process, since displaying such an excessive amount of records may potentially impact the Ultra Chart initial rendering time as well?

    Taking a step back, as an alternative solution I would suggest to consider leveraging the UltraDataChart instead. It is the more modern and supported charting component in the Ultimate UI for Windows Forms suite as opposed to the UltraChart who is practically retired.

    The UltraDataChart can be saved as an image, which I have tested and seems to be working pretty fast for large datasets making up the visualization. Actually, if the chart being exported as PDF format is a must-have requirement for you, a Report that includes it can always be generated through the Document Engine once the image has been exported.

    For your convenience, I am attaching such a sample app demonstrating this alternative. Please, note the chart visualization does not represent anything meaningful and is only rendered with as many data items for the purposes of the example.

    As you will notice, the chart is rendering and exporting in a PDF document quite quickly. In conclusion, please, check out the referenced resources and let me know if you need any further assistance on the matter.

    Best regards,
    Bozhidara Pachilova
    Software Developer

    7282.UDC_Stacked_Column_Series.zip

Reply Children