Tee Chart as Thumb Nail

TeeChart for ActiveX, COM and ASP
Post Reply
Areef
Newbie
Newbie
Posts: 8
Joined: Wed Jun 22, 2005 4:00 am

Tee Chart as Thumb Nail

Post by Areef » Mon May 21, 2007 6:55 am

Hi,

I want to display the Tee Chart which I am already exporting as PNG Image as Thumb Nail version. Can some one tell me how can I do so?

Thanks,
Areef

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

Post by Narcís » Mon May 21, 2007 8:11 am

Hi Areef,

When exporting a chart to an image you can specify the size of the image you want to generate, for example:

Code: Select all

    TChart1.Export.asPNG.Height = 20
    TChart1.Export.asPNG.Width = 50
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

Areef
Newbie
Newbie
Posts: 8
Joined: Wed Jun 22, 2005 4:00 am

Post by Areef » Mon May 21, 2007 8:42 am

Hi Narcís,

It does NOT help me. My Tee Chart is best viewed at 720*360 (Width*Hieght) size. Now, I want the same Image to be available in smaller size of say 50*20. if I change the Width and Height as suggested by you here, the Image is LOST and only some portion of the Image is shown.

Thanks and Regards,
Areef

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

Post by Narcís » Mon May 21, 2007 8:48 am

Hi Areef,

Then you could save the chart's size in temporary variables, resize it to 50*20, export the chart and resize the chart again to the original dimensions.
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

Areef
Newbie
Newbie
Posts: 8
Joined: Wed Jun 22, 2005 4:00 am

Post by Areef » Mon May 21, 2007 8:58 am

I think I did't get exactly what you wanted me to do.

My code is as follows.

Code: Select all

	
tchart.Export.asPNG.Width = 720;
tchart.Export.asPNG.Height = 360;
return ((byte[]) tchart.Export.asPNG.SaveToStream());
I want this same code to be running in 2 modes, one mode while exporting as Full Image and another mode to export as Thumb Nail basically a smaller view of the same Image.

Could you help me in re-arranging the code so that I achieve my task?

Thanks again and Regards,
Areef

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

Post by Narcís » Mon May 21, 2007 9:08 am

Hi Areef,

My suggestion was something like this:

Code: Select all

    Dim tmpW, tmpH As Integer
    
    tmpW = TChart1.Width
    tmpH = TChart1.Height
    
    'Export chart
    TChart1.Export.asPNG.SaveToFile FileName
    
    'Export thumbnail
    TChart1.Width = 50
    TChart1.Height = 20
    TChart1.Export.asPNG.SaveToFile ThumbnailName
    
    'Restore original chart dimensions
    TChart1.Width = tmpW
    TChart1.Height = tmpH
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

Areef
Newbie
Newbie
Posts: 8
Joined: Wed Jun 22, 2005 4:00 am

Post by Areef » Mon May 21, 2007 9:21 am

When I am exporting in one style/mode I am not worried about the other style/mode.

When I am in Full Image Modei will export as Full Image only and not worried about Thumb Nail version and similarly when I am in Thumb Nail mode, I will export as Thumb Nail only and dont bother to resize back to normail Image mode.

So, my code snippet would be like this.

Code: Select all


If (ExportAsFullImage)
{
   tchart.Export.asPNG.Width = 720;
   tchart.Export.asPNG.Height = 360;
   return ((byte[]) tchart.Export.asPNG.SaveToStream());
}
else if (ExportAsThumbNail)
{
   tchart.Export.asPNG.Width = 70;
   tchart.Export.asPNG.Height = 60;
   return ((byte[]) tchart.Export.asPNG.SaveToStream());
}
If you observe here, I am not deling here with File Names at all and am exporting to stream and this stream is written to screen. I tried with this code only and when I am exporting as Thumbnail, the Image gets clipped rather than showing as a small Image.

I was wondering does the Zoom or CompressionLevel properties help me in any way?

Regards,
Areef

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

Post by Narcís » Mon May 21, 2007 9:31 am

Hi Areef,

Please notice that the code I posted actually resizes the chart, not the exported image. Could you please try if it works fine at your end?

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

Areef
Newbie
Newbie
Posts: 8
Joined: Wed Jun 22, 2005 4:00 am

Post by Areef » Mon May 21, 2007 9:46 am

I tried with the code as follows:

Code: Select all

          tchart.Width = 70;
          tchart.Height = 60;
          return ((byte[]) tchart.Export.asPNG.SaveToStream());
But, again here also the same result of clipping of the Image. is it correct what I am doing here?

Regards,
Areef

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu May 31, 2007 4:03 pm

Hi Areef,

yes, one way to accomplish it, as you said, would be using the Zoom. You will have to change the Zoom before to do the export :
TChart1.Aspect.Zoom = 150
or assign it to 100 depending on the choosed option.

Post Reply