Output Quality (TChart v3.5.3498327368)
Output Quality (TChart v3.5.3498327368)
All I am doing is: create a pie chart, show it on my form. Editing is done using the Chart Editor provided by TChart. I am setting Chart.Aspect.SmoothingMode to SmoothingMode.AntiAlias (I did try to set it to SmoothingMode.HighQuality and result was basically the same). I have a button on my form to save the chart as a metafile (so I can include the image into my report). I am using EmfType.EmfPlusOnly option. I am attaching the screen shot of my form and the image file created (I had to save it as PNG for upload, but the quality is the same). The quality of the image is unacceptable (note, that shadows are missing, text is different, let alone the pie itself...). What can be done to improve it?
- Attachments
-
- SameChart.png (32.47 KiB) Viewed 8769 times
-
- ScreenShot.jpg (27.71 KiB) Viewed 8715 times
Re: Output Quality (TChart v3.5.3498327368)
Hi UserLS,
I've tried to obtain a chart similar to yours with the following code:
The result is a metafile that could be probably improved in quality (I've added this to the wish list to be enhanced for further releases [TF02014378]) but I'm not able to reproduce your problem with the shadows. Could you please try it and see if the shadows are correctly exported?
I've tried to obtain a chart similar to yours with the following code:
Code: Select all
private void InitializeChart()
{
chartController1.Chart = tChart1;
tChart1.Aspect.Chart3DPercent = 50;
tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
tChart1.Header.Text = "This is an example of my graph";
tChart1.Header.Transparent = false;
tChart1.Header.Gradient.Visible = true;
tChart1.Header.Shadow.Visible = true;
tChart1.Header.Shadow.Height = 10;
tChart1.Header.Shadow.Width = 10;
tChart1.Header.Shadow.Color = Color.LightGray;
tChart1.Header.Shadow.Smooth = true;
tChart1.Header.Font.Name = "Gabriola";
tChart1.Header.Font.Italic = true;
tChart1.Header.Font.Size = 18;
tChart1.Legend.Title.Text = "THIS IS MY LEGEND";
tChart1.Legend.Title.Visible = true;
tChart1.Legend.Title.Gradient.Visible = true;
tChart1.Legend.Shadow.Height = 10;
tChart1.Legend.Shadow.Width = 10;
tChart1.Legend.Shadow.Color = Color.LightGray;
tChart1.Legend.Gradient.Visible = true;
tChart1.Legend.Shadow.Smooth = true;
Pie pie1 = new Pie(tChart1.Chart);
pie1.FillSampleValues();
pie1.Transparency = 50;
pie1.BevelPercent = 10;
pie1.EdgeStyle = Steema.TeeChart.Drawing.EdgeStyles.Curved;
pie1.Shadow.Height = 350;
pie1.Shadow.Color = Color.LightGray;
pie1.Marks.Visible = false;
pie1.Shadow.Visible = true;
tChart1.Aspect.Elevation = 290;
}
private void button1_Click(object sender, EventArgs e)
{
tChart1.Export.Image.Metafile.EMFFormat = System.Drawing.Imaging.EmfType.EmfPlusOnly;
tChart1.Export.Image.Metafile.Save("C:\\tmp\\test.emf");
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Output Quality (TChart v3.5.3498327368)
I could not make your code work for me when I have a dynamically generated chart, which does not have a parent form. Every time it hits the line:
it throws an exception "Parameter is not valid." Instead I have to do the following:
and that is when I am missing the shadows and the fonts are not right either.
My problem is that I have another form active at the time with the whole report being displayed there. I have to generate the Chart image in memory and insert it into the report. I cannot show another form during this process, but it seems to me, that in order to get an OK quality of the chart image I have to place it onta a form and show it ! So, what should I do?
Another observation: I really do not need a file saved on disk, so I did try to save metafile to a memory stream, but I could not use this stream to generate image from it (using Image.FromStream() method).
Code: Select all
tChart1.Export.Image.Metafile.Save("C:\\tmp\\test.emf");
Code: Select all
PictureBox image;
...
image.Image = chart.Chart.Metafile(new MemoryStream(), chart.Chart, chart.Width, chart.Height, EmfType.EmfPlusOnly);
image.Image.Save("C:\\tmp\\test.emf");
My problem is that I have another form active at the time with the whole report being displayed there. I have to generate the Chart image in memory and insert it into the report. I cannot show another form during this process, but it seems to me, that in order to get an OK quality of the chart image I have to place it onta a form and show it ! So, what should I do?
Another observation: I really do not need a file saved on disk, so I did try to save metafile to a memory stream, but I could not use this stream to generate image from it (using Image.FromStream() method).
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Output Quality (TChart v3.5.3498327368)
Hi UserLS,
Ok, this is because you need to set your chart's Chart dimensions before exporting it, for example:My problem is that I have another form active at the time with the whole report being displayed there. I have to generate the Chart image in memory and insert it into the report. I cannot show another form during this process, but it seems to me, that in order to get an OK quality of the chart image I have to place it onta a form and show it ! So, what should I do?
Code: Select all
myChart.Export.Image.Metafile.EMFFormat = System.Drawing.Imaging.EmfType.EmfPlusOnly;
myChart.Chart.Width = this.Width;
myChart.Chart.Height = this.Height;
myChart.Export.Image.Metafile.Save("C:\\temp\\myChart.emf");
Maybe you need to set stream's position to zero before reading it. Code below work fine for me here.Another observation: I really do not need a file saved on disk, so I did try to save metafile to a memory stream, but I could not use this stream to generate image from it (using Image.FromStream() method).
Code: Select all
private void button1_Click(object sender, EventArgs e)
{
//tChart1.Export.Image.Metafile.EMFFormat = System.Drawing.Imaging.EmfType.EmfPlusOnly;
//tChart1.Export.Image.Metafile.Save("C:\\temp\\test.emf");
myChart.Export.Image.Metafile.EMFFormat = System.Drawing.Imaging.EmfType.EmfPlusOnly;
myChart.Chart.Width = this.Width;
myChart.Chart.Height = this.Height;
System.IO.MemoryStream imageStream = new System.IO.MemoryStream();
myChart.Export.Image.Metafile.Save(imageStream);
imageStream.Position = 0;
pictureBox1.Image = Image.FromStream(imageStream);
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Output Quality (TChart v3.5.3498327368)
Thanks! This works a lot better! As you've mentioned, the quality could be better, but with all the changes you've suggested, our output now is at least not worse (and in some cases better) than the Win32 version.
Re: Output Quality (TChart v3.5.3498327368)
Ok, I did have some problems with the image files, so I tried to go strait to PDF format... The same graph in PDF looks awful (I would attach it, if your site allowed PDF files). Is there any way to make it reasonably good?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Output Quality (TChart v3.5.3498327368)
Hi UserLS,
Can you please compress the file in a .zip package and attach it here or send it at http://www.steema.net/upload?
Thanks in advance.
Can you please compress the file in a .zip package and attach it here or send it at http://www.steema.net/upload?
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Output Quality (TChart v3.5.3498327368)
Here it is!
- Attachments
-
- SameGraph.zip
- (11.3 KiB) Downloaded 434 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Output Quality (TChart v3.5.3498327368)
Hi UserLS,
Thanks for the file. I'm afraid the problem is that TeeChart's PDF export doesn't support transparency. This is already in the wish list (TF02013896) to be enhanced for future releases. In the meantime a workaround is exporting the chart to an image and then convert it to a PDF file.
Thanks for the file. I'm afraid the problem is that TeeChart's PDF export doesn't support transparency. This is already in the wish list (TF02013896) to be enhanced for future releases. In the meantime a workaround is exporting the chart to an image and then convert it to a PDF file.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |