Hi.
I create an ultrachart and then call the RenderPDFFriendlyGraphics function to render the chart to a pdf report. The code looks like this:
ICanvas canvas = newFlow.AddCanvas();
canvas.Width = new FixedWidth(210);
canvas.Height = new FixedHeight(170);
Graphics g = canvas.CreateGraphics();
ultraChart1.RenderPdfFriendlyGraphics(g);
The RenderPDFFriendlyGraphics takes a long time to execute. Is this normal? My chart consists of about 50 series each of 175 points.
Hello Sudnya,
Please answer the following questions for me so I can better assist you.
I am using NetAdvantage Windows Forms 2010.2 and visual Studio 2010.
I wasn't able to get your modified sample to run, so I created my own sample that exports a chart to a PDF using the RenderPDFFriendlyGraphics() method. I'd like you to check the sample out to see if it reproduces the issue. If it doesn't, then compare it with your sample to see what I might be doing differently.
Hi Dave.
I looked at your sample. I think you are asking me to compare apples and oranges. You are creating a scatter chart and I am creating a spline chart. Also another reason your sample cannot be compared to is because we are using a reportPreviewCtrl on which we draw. I wonder if thats different than drawing on a form directly.
Also I downloaded my modified sample. It is runnable. When you run the program you have to wait half a minute to see anything on the screen because thats how long it takes for the Render function to run!!! You just have to give it time to run. If not put a break point on the Render funtion so that you dont feel like the program isnt running.
If you create a sample which draws 70+ splines on a chartr and drops that on a reportPreviewCtrl , I think that would help me immensely to determine what I am doing wrong.
I was able to reproduce the issue in my sample by copying some parts of your code into my sample. After doing so I discovered that the PrintPreviewControl has nothing to do with this issue, since the call to RenderPdfFriendlyGraphics() is before any reference to the PrintPreviewControl.
I believe the issue may have something to do with how you're setting up the data since if I set the chart to be visible, I get an error about there being no data. I will do some more research and update this thread again tomorrow.
Thanks Dave. I really appreciate your help.
I've done some more testing and it appears the delay is happening because of the amount of data being plotted. You can verify this yourself by commenting out the second loop in the CreateCharts() method in your sample. You'll see that the amount of time taken is just about halved.
Sorry for the delay but I found the cause of the issue and it is currently being verified and if all goes well a fix will be available in the next Service Release. Let me know if you see anything else performance related to the chart -> pdf process but I think you'll be pleasantly surprised by the speed of the process now.
I've submitted this issue to our engineers for them to research. I've created a private support case so you can be notified of the results of their research.
Thats what we currently do in the application. However, when the bitmap is plotted on a PDF and the document is zoomed the bitmap loses its resolution and looks grainy. This was the reason I was exploring other options and came across the RenderPDFFriendlyGraphics function.
So using the bitmap is not really an option.
It might be more feasible for you to call DrawToBitmap() and then insert that bitmap into the document.
OK. I am working with medical software and this will be the minimum amount of data I am plotting per graph. Plus I am plotting 6 such graphs.
So that probably means using the infragistics chart in this situation is not going to deliver the results in a resonable amount of time. Do you have any other suggestions as to what I can use.
Thanks.
Sudnya