Chart Metafile Export

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
GregSki
Newbie
Newbie
Posts: 3
Joined: Mon Mar 27, 2006 12:00 am

Chart Metafile Export

Post by GregSki » Tue Aug 22, 2006 12:41 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Aug 22, 2006 2:14 pm

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?
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

GregSki
Newbie
Newbie
Posts: 3
Joined: Mon Mar 27, 2006 12:00 am

Post by GregSki » Thu Aug 24, 2006 10:25 am

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?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Aug 24, 2006 10:29 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

GregSki
Newbie
Newbie
Posts: 3
Joined: Mon Mar 27, 2006 12:00 am

Post by GregSki » Thu Aug 24, 2006 11:51 am

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Aug 24, 2006 2:39 pm

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
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply