Export & Resize JPEG Image of Chart

TeeChart for ActiveX, COM and ASP
Post Reply
TomB
Newbie
Newbie
Posts: 4
Joined: Tue Nov 20, 2007 12:00 am

Export & Resize JPEG Image of Chart

Post by TomB » Tue Jan 13, 2009 5:29 pm

I am trying to export a JPEG image of a pie chart I have created. If I do not resize the image, it looks great - but if a try to resize the Chart it is unreadable - pie shape changes radically or disappears, etc.

Code I use in Visual FoxPro (VFP):

With thisform.mmTeeChart_Pie.Export.asJPEG
.CompressionQuality = 90
.GrayScale = .F.
.Height = 105
.Width = 120
.SaveToFile("c:\pie.jpg")
ENDWITH

All I want is an image that looks EXACTLY like the bigger version - only smaller (like a thumbnail). Maybe just specify width and be able to use "Keep Aspect Ratio" type command to calculate the height. Is that possible?

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

Post by Narcís » Wed Jan 14, 2009 8:34 am

Hi Tom,

This is because chart's legend and pie's mark don't let the pie be visible you can do something like this:

Code: Select all

Private Sub Command1_Click()

    TChart1.Legend.Visible = False
    TChart1.Series(0).Marks.Visible = False
    
    With TChart1.Export.asJPEG
        .CompressionQuality = 90
        .GrayScale = False
        .Height = 105
        .Width = 120
        .SaveToFile ("c:\temp\pie.jpg")
    End With
    
    TChart1.Legend.Visible = True
    TChart1.Series(0).Marks.Visible = True
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