Page 1 of 1

Runtime changes to Chart Title

Posted: Fri Mar 09, 2007 12:55 pm
by 8441261
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.

Posted: Fri Mar 09, 2007 1:02 pm
by narcis
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?

Posted: Fri Mar 09, 2007 2:16 pm
by 8441261
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

Posted: Mon Mar 12, 2007 9:51 am
by Pep
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");

Posted: Wed Mar 21, 2007 12:38 pm
by 8441261
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

Posted: Mon Mar 26, 2007 2:36 pm
by Pep
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).

Posted: Fri Mar 30, 2007 3:53 pm
by 8441261
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

Posted: Mon Apr 02, 2007 4:02 pm
by Marjan
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.