Hello,
I need to store as JPEG a graphic which includes a Tchart and Labels (over the Tchart). I use Borland C++ Builder 6.0 and Teechart. The method that I use is the following:
//--------------------------------------------------------------------------------------------
Graphics::TBitmap *TmpFormImage = NULL;
TJPEGImage *FormImage = NULL;
//Generate the diagram
FormESAdiagram = new TFormESAdiagram(Application,dbg,mode); // Form creation
//Store diagram with JPG format in the corresponding directory
try
{
TmpFormImage = FormESAdiagram->GetFormImage();
FormImage = new TJPEGImage();
FormImage->Assign(TmpFormImage);
FormImage->SaveToFile(filename);
}
catch(Exception &E)
{
sprintf(sentence,"%s could not be created",filename);
Serv->PrintError(WARNING,sentence, __FILE__,__LINE__);
}
if (FormImage) delete FormImage;
if (TmpFormImage) delete TmpFormImage;
Formdiagram->Close();
delete Formdiagram;
//--------------------------------------------------------------------------------------------
After several executions I realise that this function “SaveToFile” sometimes does not store correctly the graphic. What could I do to make sure that the graphic is always saved correctly?
Thanks in advance,
Elisabet
Problem at storing a graphic as JPEG
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hello Elisabet,
Why don't you try using TAnnotationTool instead of labels over the chart and then try TeeChart's exporting features? You'll find more information on exporting and chart tools in the features demo. You may also be interested in reading Tutorial 12 - Exporting and Importing Charts. You'll find the tutorials and demo at TeeChart's program group.
Hope this helps!
Why don't you try using TAnnotationTool instead of labels over the chart and then try TeeChart's exporting features? You'll find more information on exporting and chart tools in the features demo. You may also be interested in reading Tutorial 12 - Exporting and Importing Charts. You'll find the tutorials and demo at TeeChart's program group.
Hope this helps!
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hello again,
Thank you so much for your support, that method works much better!! Just one question more. I need to include a Timage over the Tchart, but I don’t want to include it in the Series, I want it to be down the legend. I have tried to include a Timage using the Tchart Tools option, but this image is included inside the TcolorGridSeries and not over the Form. On the other hand, if I include a Timage that does not belong to the Tchart the function “TeeSaveToJPEGFile” does not catch this image. What could I do?
Thank you for your help,
Elisabet
Thank you so much for your support, that method works much better!! Just one question more. I need to include a Timage over the Tchart, but I don’t want to include it in the Series, I want it to be down the legend. I have tried to include a Timage using the Tchart Tools option, but this image is included inside the TcolorGridSeries and not over the Form. On the other hand, if I include a Timage that does not belong to the Tchart the function “TeeSaveToJPEGFile” does not catch this image. What could I do?
Thank you for your help,
Elisabet
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Elisabet,
In that case the easiest solution is using a TRectangleTool tool. You can set it to not transparent and assign an image to its Picture property. Then you can set it to a custom position below the legend, for example:
Hope this helps!
In that case the easiest solution is using a TRectangleTool tool. You can set it to not transparent and assign an image to its Picture property. Then you can set it to a custom position below the legend, for example:
Code: Select all
ChartTool2.Shape.Transparency:=0;
ChartTool2.Shape.Transparent:=false;
ChartTool2.Shape.Picture.LoadFromFile('c:\temp\GridOverlayIssue.bmp');
Chart1.Draw;
tmpW:=ChartTool2.Width;
tmpH:=ChartTool2.Height;
ChartTool2.Shape.CustomPosition:=true;
ChartTool2.Shape.Left := Chart1.Legend.Left;
ChartTool2.Shape.Top := Chart1.Legend.ShapeBounds.Bottom;
ChartTool2.Width:=tmpW;
ChartTool2.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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Elisabet,
Rectangle tool was implemented in v7. However, current version is number 8.
You can upgrade your v6 license to v8 here.
Without using Rectangle tool you can also do something like what's discussed here.
I've also sent you an example project doing what you request.
Rectangle tool was implemented in v7. However, current version is number 8.
You can upgrade your v6 license to v8 here.
Without using Rectangle tool you can also do something like what's discussed here.
I've also sent you an example project doing what you request.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
We are thinkg of updating the Teechart version. Teechart version 8 is compatible with Borland C++ Builder v6??
You said in your last response that you have sent me an example project doing what I requested. How can I see that exapmle project? Where have you sent me that project?
Thank your. Best regards,
Elisabet
You said in your last response that you have sent me an example project doing what I requested. How can I see that exapmle project? Where have you sent me that project?
Thank your. Best regards,
Elisabet
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Elisabet,
Yes, v8 supports BCB 6.We are thinkg of updating the Teechart version. Teechart version 8 is compatible with Borland C++ Builder v6??
I sent the example project at your forums profile e-mail address. You can change it at any moment and I can resend you the e-mail. I can also post the project at news://www.steema.net/steema.public.attachments newsgroup or at our website.You said in your last response that you have sent me an example project doing what I requested. How can I see that exapmle project? Where have you sent me that project?
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |