Hi;
I am writing the following code to export my chart to a pdf file, the problem is once it executes to the line:
this.ultraChart1.RenderPdfFriendlyGraphics(g);
It stucks, and can not continue, can u help me figure out which part is wrong?
thanks ...
The codes are the following, ultrabutton1 is for pdf file export:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Infragistics.Documents.Report;
{
//Create a new reportInfragistics.Documents.Report.Report r = new Infragistics.Documents.Report.Report();Graphics g = r.AddSection().AddCanvas().CreateGraphics();ultraChart1.RenderPdfFriendlyGraphics(g);//Define a string that contains the path to// the current user's My Documents folder.string myDocuments = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);// Publish the report to the current user's // My Documents folder with the name of Report.pdf.r.Publish(myDocuments + "\\Report.pdf", FileFormat.PDF);
//Create a new report
new
//Define a string that contains the path to// the current user's My Documents folder.
string
// Publish the report to the current user's // My Documents folder with the name of Report.pdf.
}
it's possible this is just typical performance for the chart, but a minute for 150 points seems a bit slow to me. here are my benchmarks using a 2.13GHz Core2 with 3.25GB of RAM
scatter chart with 15000 points: 4.02 seconds
scatter chart with 1500 points: 2.36 seconds
scatter chart with 150 points: 0.47 seconds
here is the code i'm using
private void Form1_Load(object sender, EventArgs e){ XYSeries xy = new XYSeries(); for (int current = 0; current < 150; current++) { xy.Points.Add(new XYDataPoint((double)current, (double)current, current.ToString(), false)); } this.ultraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.ScatterChart; this.ultraChart1.Series.Add(xy);}private void button1_Click(object sender, EventArgs e){ DateTime start = DateTime.Now; //Create a new report Infragistics.Documents.Report.Report r = new Infragistics.Documents.Report.Report(); Graphics g = r.AddSection().AddCanvas().CreateGraphics(); ultraChart1.RenderPdfFriendlyGraphics(g); //Define a string that contains the path to // the current user's My Documents folder. string myDocuments = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); // Publish the report to the current user's // My Documents folder with the name of Report.pdf. r.Publish(myDocuments + "\\Report.pdf", FileFormat.PDF); Console.WriteLine(DateTime.Now.Subtract(start).ToString());}
Hi,
Later yesterday I found it's caused by too much points on my scatter chart. My chart has 15000 points need to be draw. The problem is even I reduce it to 150 points, it still takes almost an minute to get the pdf file.
Is there any solution that can speed up the pdf generation, I mean any code settings that can speed it up?