BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Save TeeChart as JPeg in D2007

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Reporting-Charting
View previous topic :: View next topic  
Author Message
Ken Davies
Guest





PostPosted: Tue May 15, 2007 12:16 am    Post subject: Save TeeChart as JPeg in D2007 Reply with quote



I'd like to save a chart as a jpeg file. Is there any way of doing this in
D2007? There doesn't seem to a any documentation for teecharts in the help
files.

TIA

Ken Davies
Back to top
David Berneda
Guest





PostPosted: Tue May 15, 2007 2:29 pm    Post subject: Re: Save TeeChart as JPeg in D2007 Reply with quote



Hi Ken
The code below creates a jpeg and as an example it saves the jpeg to a file
in c:\ folder.
The jpeg "CompressionQuality" parameter is important to balance between jpeg
file size and image quality.

TeeChart help files, tutorials, docs and examples can be found free of
charge inside the
trial versions of TeeChart "Pro", at www.teechart.com

regards
david
www.teechart.com

uses
JPEG;

function ChartToJpeg(Chart:TCustomChart):TJPEGImage;
var tmpBitmap : TBitmap;
begin
result:=TJPEGImage.Create;

{ create a temporary bitmap }
tmpBitmap:=Chart.TeeCreateBitmap;

try
{ set the desired JPEG options... }
With result do
begin
CompressionQuality:=95;

{ Copy the temporary Bitmap onto the JPEG image... }
Assign(tmpBitmap);
end;
finally
tmpBitmap.Free; { <-- free the temporary Bitmap }
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var MyJpeg : TJPEGImage;
begin
MyJpeg:=ChartToJpeg(Chart1);
try
MyJpeg.SaveToFile('c:\test.jpg');
finally
MyJpeg.Free;
end;
end;



"Ken Davies" <krdavies (AT) ivojo (DOT) co.uk> wrote in message
news:4648b5d4$1 (AT) newsgroups (DOT) borland.com...
Quote:
I'd like to save a chart as a jpeg file. Is there any way of doing this in
D2007? There doesn't seem to a any documentation for teecharts in the help
files.
Back to top
Ken Davies
Guest





PostPosted: Tue May 15, 2007 2:42 pm    Post subject: Re: Save TeeChart as JPeg in D2007 Reply with quote



Many thanks for the fast respose. A quick question about the Pro version:
I'm creating a simple line chart with two series. Would the Pro version
allow me to shade the area between the series lines with a colour?

Many thanks,

Ken Davies


"David Berneda" <david (AT) steema (DOT) com> wrote in message
news:46497d7e$1 (AT) newsgroups (DOT) borland.com...
Quote:
Hi Ken
The code below creates a jpeg and as an example it saves the jpeg to a
file in c:\ folder.
The jpeg "CompressionQuality" parameter is important to balance between
jpeg file size and image quality.

TeeChart help files, tutorials, docs and examples can be found free of
charge inside the
trial versions of TeeChart "Pro", at www.teechart.com

regards
david
www.teechart.com

uses
JPEG;

function ChartToJpeg(Chart:TCustomChart):TJPEGImage;
var tmpBitmap : TBitmap;
begin
result:=TJPEGImage.Create;

{ create a temporary bitmap }
tmpBitmap:=Chart.TeeCreateBitmap;

try
{ set the desired JPEG options... }
With result do
begin
CompressionQuality:=95;

{ Copy the temporary Bitmap onto the JPEG image... }
Assign(tmpBitmap);
end;
finally
tmpBitmap.Free; { <-- free the temporary Bitmap }
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var MyJpeg : TJPEGImage;
begin
MyJpeg:=ChartToJpeg(Chart1);
try
MyJpeg.SaveToFile('c:\test.jpg');
finally
MyJpeg.Free;
end;
end;



"Ken Davies" <krdavies (AT) ivojo (DOT) co.uk> wrote in message
news:4648b5d4$1 (AT) newsgroups (DOT) borland.com...
I'd like to save a chart as a jpeg file. Is there any way of doing this
in D2007? There doesn't seem to a any documentation for teecharts in the
help files.

Back to top
Narcís Calvet
Guest





PostPosted: Tue May 15, 2007 5:04 pm    Post subject: Re: Save TeeChart as JPeg in D2007 Reply with quote

Hi Ken,

Ken Davies wrote:
Quote:
Many thanks for the fast respose. A quick question about the Pro
version: I'm creating a simple line chart with two series. Would the
Pro version allow me to shade the area between the series lines with
a colour?

Yes, this is possible using SeriesBand tool included with TeeChart Pro v7
VCL. You can download the fully functional evaluation version here:

http://www.steema.com/downloads/form_tch_vcl.html


--
Best Regards,

Narcis Calvet
Steema Support Central
http://support.steema.com

"Important note: If you are a TeeChart registered customer, please post your
support questions at Steema's Support monitored Forums for customers:
http://support.steema.com for a prompter reply."
Back to top
Mat Ballard
Guest





PostPosted: Wed May 16, 2007 4:47 am    Post subject: Re: Save TeeChart as JPeg in D2007 Reply with quote

Ken Davies wrote:

Quote:
I'd like to save a chart as a jpeg file. Is there any way of doing this

Bad idea (TM). Introduces lots of visual artifacts. You don't need the 24-bit
colour either.

Use a GIF instead - TGifImage - 8 bit, non-lossy. Just save your chart as a
bitmap in memory, assign the bitmap to the TGifImage, and save the TGifImage.

Suggest you experiment in your favourite image editor to _see_ why.
Back to top
Ken Davies
Guest





PostPosted: Tue May 22, 2007 8:12 am    Post subject: Re: Save TeeChart as JPeg in D2007 Reply with quote

Done that, see what you mean.

Cheers

"Mat Ballard" <mat (AT) chemwares (DOT) com> wrote in message
news:464a4675$1 (AT) newsgroups (DOT) borland.com...
Quote:
Ken Davies wrote:

I'd like to save a chart as a jpeg file. Is there any way of doing this

Bad idea (TM). Introduces lots of visual artifacts. You don't need the
24-bit
colour either.

Use a GIF instead - TGifImage - 8 bit, non-lossy. Just save your chart as
a
bitmap in memory, assign the bitmap to the TGifImage, and save the
TGifImage.

Suggest you experiment in your favourite image editor to _see_ why.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Reporting-Charting All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.