Page 1 of 1
Chart Metafile Export
Posted: Tue Aug 22, 2006 12:41 pm
by 9640769
I am having trouble altering the dimensions of the metafile when exporting a chart to it.
No matter what values I enter for Width and Height the dimensions of the file are exactly the same. ie. 387X284
What am I doing wrong here?
gphPie.Export.Image.Metafile.bEnhanced = True
gphPie.Export.Image.Metafile.Width = 500
gphPie.Export.Image.Metafile.Height = 300
gphPie.Export.Image.Metafile.Save(FileName)
I tried changing the size of the chart on the window form but to no avail.
Is this a known bug or am I missing something?
Thanks.
BTW The chart I am exporting is a pie chart and using version 2.0.2306.26231.
Posted: Tue Aug 22, 2006 2:14 pm
by narcis
Hi GregSki,
It works fine for me here using the latest debug build available at the customer area and using this code:
Code: Select all
Steema.TeeChart.Export.MetafileFormat metaFile = tChart1.Export.Image.Metafile;
metaFile.Height = 300;
metaFile.Width = 500;
metaFile.bEnhanced = true;
metaFile.Save(FileName);
Can you please test if it works at your end?
Posted: Thu Aug 24, 2006 10:25 am
by 9640769
Still isn't working. Setting of the Width and Height properties has no effect on the dimensions of the image whatsoever.
Using version 2.0.2351.18996 in VB.NET and VS 2005.
Any other ideas?
Posted: Thu Aug 24, 2006 10:29 am
by narcis
Hi GregSki,
Could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at news://
www.steema.net/steema.public.attachments newsgroup.
Thanks in advance.
Posted: Thu Aug 24, 2006 11:51 am
by 9640769
I haven't got a news reader.
You can downlaod the VS 2005 project from
here.
Sizing of GIF, JPG images works fine but not EMF.
On my computer the dimensions of the file are 351X225.
Posted: Thu Aug 24, 2006 2:39 pm
by narcis
Hi GregSki,
Thank you very much for the project.
I could fine what the problem is. This only happens when you set
CustomXRadius and
CustomYRadius for the pie series. I've added the defect (TF02011722) to our bug list to be fixed for future releases.
In the meantime, a workaround is setting those properties to automatic (zero) before exporting to metafile and setting them back to the original value:
Code: Select all
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
gphPie.Header.Text = "Title"
gphPie.Series(0).Clear()
gphPie.Series(0).Add(1000, "Rental (" & Format(0.8, "#0.0%") & ")", Color.FromArgb(38, 81, 222))
gphPie.Series(0).Add(100, "Tax Savings (" & Format(0.1, "#0.0%") & ")", Color.FromArgb(111, 137, 222))
gphPie.Series(0).Add(100, "Contribution (" & Format(0.1, "#0.0%") & ")", Color.FromArgb(212, 219, 255))
gphPie.Refresh()
'Workaround Section 1
Dim tmpX As Integer = Me.Pie1.CustomXRadius
Dim tmpY As Integer = Me.Pie1.CustomYRadius
Me.Pie1.CustomXRadius = 0
Me.Pie1.CustomYRadius = 0
'End Workaround Section 1
Dim metaFile As Steema.TeeChart.Export.MetafileFormat
metaFile = gphPie.Export.Image.Metafile
metaFile.Width = 50
metaFile.Height = 30
metaFile.bEnhanced = True
metaFile.Save(Application.StartupPath & "\test.emf")
'Workaround Section 2
Me.Pie1.CustomXRadius = tmpX
Me.Pie1.CustomYRadius = tmpY
'End Workaround Section 2
End Sub