Runtime changes to Chart Title

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
rbarnes
Newbie
Newbie
Posts: 4
Joined: Mon Feb 10, 2003 5:00 am
Location: UK

Runtime changes to Chart Title

Post by rbarnes » Fri Mar 09, 2007 12:55 pm

Hi,
I'm currently using TeeChart V6.01 with Borland C++ Builder 6 and am trying to change a chart title property during runtime. I have a chart added to my form at design time with a default title which is displayed without problem. However, during runtime the Title property of the chart is NULL so any access to it results in an EAccessViolation exception.

I'm trying to add the title using:

aChart->Title->Text->Add("myTitle");

I should add that I have tried explicitly calling the new operator on the chart (though I assume this is called already since the chart is design-time) without any success.
Also, I have tried to create an instance of a TChartTitle and assign to the chart but the new operator of the TChartTitle expects a TCustomChart object and my chart is a TChart type so it fails at link-time.

Any help much appreciated.

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

Post by Narcís » Fri Mar 09, 2007 1:02 pm

Hi rbarnes,
I should add that I have tried explicitly calling the new operator on the chart (though I assume this is called already since the chart is design-time) without any success.
Also, I have tried to create an instance of a TChartTitle and assign to the chart but the new operator of the TChartTitle expects a TCustomChart object and my chart is a TChart type so it fails at link-time.
Have you tried type casting your TChart object to a TCustomChart?
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

rbarnes
Newbie
Newbie
Posts: 4
Joined: Mon Feb 10, 2003 5:00 am
Location: UK

Post by rbarnes » Fri Mar 09, 2007 2:16 pm

I have just tried to cast to TCustomChart when instantiating a TChartTitle but still get an unresolved external linker error (it can't resolve the constructor for the TChartTitle). Am I missing a header/library file?

Also, why would the chart title property be NULL at runtime when I specify a default (design-time) title which is then displayed at runtime without problem? According to documentation, all I should need to do to edit the title is something like:

aChart->Title->Text->Clear();
aChart->Title->Text->Add("My Title");


Thanks
Richard

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Mar 12, 2007 9:51 am

Hi Richard,

to edit/modify the Chart Title you can simply do :
Chart1->Title->Caption="My Chart Title";

Or, if you want to add more title lines, then you'll have to use :
Chart1->Title->Clear();
Chart1->Title->Text->Add("Title1");
Chart1->Title->Text->Add("Title2");

rbarnes
Newbie
Newbie
Posts: 4
Joined: Mon Feb 10, 2003 5:00 am
Location: UK

Post by rbarnes » Wed Mar 21, 2007 12:38 pm

Hi,

Thanks for the response and apologies for the delay in my reply. I have tried what you suggest but it simply raises an EAccessViolation. Further inspection shows that the Title property of my chart is NULL even though it has a design-time value which is shown without problem. The problem is that I need to change the Title at run-time.

Any other ideas?

Many thanks
Richard

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Mar 26, 2007 2:36 pm

Hi Richard,

which TeeChart Pro version are you using ?
Could you please send me a simple app with which I can reproduce as is the problem here ? (you can send me it directly to pep@steema.com).

rbarnes
Newbie
Newbie
Posts: 4
Joined: Mon Feb 10, 2003 5:00 am
Location: UK

Post by rbarnes » Fri Mar 30, 2007 3:53 pm

Hi,

I'm using Version 6.01 Pro with Borland Builder 6. I experience the problem if I simply drop a chart onto a blank form then try to access the Title property at run-time. I can send an example if you like but if you have access to the above then its simple to repeat.

Regards
Richard

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Apr 02, 2007 4:02 pm

Hi.

Are you by any chance using the "Build with the runtime packages" option ? If yes, then perhaps the problem is your project is referencing old (TeeChart Standard) packages. In this case all you must do is replace references to old TeeChart bpi/lib files wih version you use.
Marjan Slatinek,
http://www.steema.com

Post Reply