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)?
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 PachilovaSoftware Developer
7282.UDC_Stacked_Column_Series.zip
Hello,Thanks for your answer. I'll definitely investigate your suggestion.We have some requirements from the customer that we must fulfill. The main ones are:1. Generate reports in excel and pdf2. Good resolution of imageThe amount of data I am talking about is:1. 2 variables on the chart2. for each variable 500,000 pointsInvestigating the 2nd point, I noticed that the image quality when using RenderPdfFriendlyGraphics is much better than when using DrawToBitmap or SaveTo.Now I am trying to prepare an example for you. I would like to make sure that the problem is reproduced on a "clean" application and this is not our mistake. If everything is as I think, I'll send you this application so that you can study it.
Hi Alexander,
Thank you for following up! Sure, please, take your time to test the suggested approach as well as to prepare an isolated version of your app scenario, so that we could investigate this further.
Best regards, Bozhidara Pachilova