Saving & Loading TeeChart defaults

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bing
Newbie
Newbie
Posts: 3
Joined: Mon Feb 18, 2008 12:00 am

Saving & Loading TeeChart defaults

Post by bing » Mon Apr 21, 2008 11:28 am

I would like for the end user to define the look of there chart using the build in Edit Chart functions. I can save and load OK but when I try to added data after loading the Series1 is no longer defind ie the pointer to Series1 is Null. How do I redefine this so that it will works as it did before loading.

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 Apr 21, 2008 1:09 pm

Hi bing,

You have 2 options here:

1. Using series index in the chart's series collection, for example:

Code: Select all

Chart1[0].Color:=clRed;
2. Assigning each series to the variable you want after loading the chart, eg.:

Code: Select all

Series1:=Chart1[0];
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

bing
Newbie
Newbie
Posts: 3
Joined: Mon Feb 18, 2008 12:00 am

Post by bing » Mon Apr 21, 2008 5:32 pm

Hi Narcís

I don't think you have understood if I load a previously save chart series into a current chart the series defined by the loaded graph has a NULL pointer. I can't add new data to the graph.

I added the following lines into the demo progam in the Export SVG to test this as part of your demo software

Code: Select all

//---------------------------------------------------------------------------

void __fastcall TSVGExportForm::Button3Click(TObject *Sender)
{
   SaveChartDialog(Chart1);
   if (OpenDialog1->Execute())
      LoadChartFromFile(dynamic_cast<TCustomChart*>(Chart1),OpenDialog1->FileName);
   
   Series1->FillSampleValues();
  
}
the line Series1->FillSampleValues(); Cause a violation error why???
if i put a watch variable onto Series1 than before load it has a valid pointer after load it has a NULL pointer


Barry

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

Post by Narcís » Tue Apr 22, 2008 10:24 am

Hi Barry,

Yes, that's the problem I tried to explain you. In that case, before calling FillSampleValues you need to do this:

Code: Select all

Series1=Chart1->Series[0];
or alternativelly use this:

Code: Select all

Chart1->Series[0]->FillSampleValues();
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
Image Image Image Image Image Image
Instructions - How to post in this forum

bing
Newbie
Newbie
Posts: 3
Joined: Mon Feb 18, 2008 12:00 am

Post by bing » Tue Apr 22, 2008 12:16 pm

Narcís

Problem solved thanks for your help.

Post Reply