Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving a Chart as a GIF File ?

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
I am able to save the display of a TDBChart component as a bitmap using the syntax 'DBChart1.SaveToBitmapFile('C:\Folder\Test.bmp').
Is it possible to save the file as a GIF file ?
Or am I looking at saving it as one file type and then having (either the application or the end user) to convert the file to a GIF file ?
Thanks in advance.
Steve
 
Hi Steve

I'm not sure if I have everything and I don't have Delphi on my workstation here so take this code with care:

var FJPEG:TJPEGImage;
begin
FJPEG.Assign(DBChart1.SaveToBitmapFile('C:\Folder\Test.bmp');
{this is the part that you need to check but essentially now you have to save the JPEG file--I'm unsure of the method though}
FJPEG.SaveToFile('C:\Folder\Test.jpeg');
end;

Hope this helps,
Rewdee
 
Thanks for the suggestion but I'm presented with an error indicating that types TPersistent and a procedure are not compatible. I've understood the logic that we're trying to apply here and tried many combinations with little success. I am able to save the chart as a bitmap, create a JPEG (of type TJPEGImage) and then assign the JPEG to equal the bitmap (through use of FJPegImage.Assign(FBitmap)) and then save the JPEG to file using FJPEGImage.SaveToFile(). Although this results in a rogue bitmap file.
Am I able to avoid this by doing it directly ?
Ideally rather than result in a JPEG file I would prefer a '.GIF' file. Is this achievable ?
Thanks again.
Steve
 
hi!

i'm trying to manipulate TDBChart in Borland C++ Builder during runtime
since i have to get the result from a query executing at runtime.

how do i do these things? i have tried the following code:
TBarSeries *MySeries;
MySeries = new TBarSeries(this);
MySeries->ParentChart = DBChart1;


but it gives me an EAccessViolation....hope somebody can help me with
this problem.

thanks in advance

 
Hi Steve,

What you could do is download a gif component (there are a
lot of freeware gif components around), run the bitmap
through it and then resave it as a gif file and then delete
the bitmap.

I hope this helps,


BobbaFet Everyone has a right to my opinion.
E-mail me at cwcon@programmer.net
Be a nice guy 'n press that little ol' button
VVV---(this one) for me ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top