TeeChart for Compact Framework: JPEG export

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

TeeChart for Compact Framework: JPEG export

Post by VESCON » Wed Nov 15, 2006 11:39 am

Hi,

it is possible to export the current TeeChart as a JPEG file (for TeeChart.Pocket)?
We want to display the current Chart in a WebPage!

The bitmap function have i found...

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 Nov 15, 2006 11:50 am

Hi VESCON,

Exporting is not currently available with TeeChart.Pocket.dll. It is already on our wish-list to be considered for inclusion in future releases.
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

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Wed Nov 15, 2006 3:29 pm

Hello,

TeeChart uses the Bitmap property/function internally to export a JPEG file. If you use the Chart property of the pocket TChart then you should be able to do something similar, e.g. (untested):

Code: Select all

	public  void Save(Stream stream) 
    {
      if (Width<=0) Width=400;
      if (Height<=0) Height=300;

      Bitmap b=chart.Bitmap(Width,Height);
      GetImageOptions(ref b);
      b.Save(stream,Encoder,EncoderParams);
      stream.Flush();
      b.Dispose();
    }
	
	public void GetImageOptions(ref Bitmap b) 
    {
      if (GrayScale) ConvertToGrayscale(ref b);
    }
	
	public ImageFormat GetFormat() 
    {
      return System.Drawing.Imaging.ImageFormat.Jpeg;
    }
	
	public ImageFormat Format 
    {
      get { return GetFormat(); }
    }
	
	public ImageCodecInfo Encoder 
    { 
      get { return GetEncoderInfo(Format.Guid); } 
    }
	
	public ImageCodecInfo GetEncoderInfo(Guid g) 
    {
      ImageCodecInfo[] encoders=ImageCodecInfo.GetImageEncoders();
      for (int t=0; t<encoders.Length; t++) 
      {
        if(encoders[t].FormatID==g)
          return encoders[t];
      }
      return null;
    }
	
	public EncoderParameters EncoderParams 
    {
      get 
      { 
        EncoderParameters result=new EncoderParameters(1);
        result.Param[0]=new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, Quality);
        return result; 
      }
    }  
	
	public int Quality
    {
      get { return quality; }
      set { quality=value; }
    }
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

VESCON
Newbie
Newbie
Posts: 11
Joined: Mon Mar 06, 2006 12:00 am

Post by VESCON » Thu Nov 16, 2006 8:23 am

Hi,

many Thanks, i will try it ;)

VESCON
Newbie
Newbie
Posts: 11
Joined: Mon Mar 06, 2006 12:00 am

Post by VESCON » Fri Dec 08, 2006 9:15 am

It doesen't work, because the classes 'ImageCodecInfo', 'EncoderParameters' etc. does not exist in CompactFramework :(

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 Dec 20, 2006 12:58 pm

Hi VESCON,

That's the reason why this can't be done :(.
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