Modification of Line Plot Title using C++

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
scottpj
Newbie
Newbie
Posts: 17
Joined: Mon May 15, 2006 12:00 am

Modification of Line Plot Title using C++

Post by scottpj » Fri Jul 07, 2006 2:08 pm

Currently I am using C++ to plot data to TDBChart.
I use the following code to modify the Title:

// clear the old names
DBChart1->Title->Text->Clear();
DBChart1->SubTitle->Text->Clear();
sprintf(Format, "%s vs %s", XUnit, YUnit);
DBChart1->Title->Text->Add(Format);
DBChart1->Title->DrawTitle();
sprintf(Format,"%s Vs %s", XName, YName);
DBChart1->SubTitle->Text->Add(Format);
DBChart1->SubTitle->DrawTitle();

but this does not work. Only the entries below the chart are being modified. Do you see what I have missed?

Thanks in advance.

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

Post by Pep » Mon Jul 10, 2006 10:55 am

Hi,

strange, it works fine here with the v7.07, I can see the title and subtitle texts. Could you please send me a simple app with which I can reproduce the problem " as is "here ? You can send me it directly to pep@steema.com

scottpj
Newbie
Newbie
Posts: 17
Joined: Mon May 15, 2006 12:00 am

I found the problem

Post by scottpj » Mon Jul 10, 2006 1:43 pm

After reviewing the example code and the hints from your comments, I decided to try adding the following:

#include <stdio.h>
#include "EditChar.hpp"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Base"
#pragma resource "*.dfm"

#pragma link "TeeSeriesTextEd"
#pragma link "TeeURL"
#pragma link "TeeXML"

After inspecting EditChar.hpp, I noticed that it includes seveal other *.hpp files.

Also, the function of the pragma smart_init looks like it might setup the pointer and storage areas.

I have not seen it before. The long and short answer is that it now works and I have the data changing. The title still does not work so I will send you my code for you to examine.

I had and still have a problem using the example code "as is" since I see a compiler error without modifing the code.

Thanks in advance for your help.

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 Jul 10, 2006 1:46 pm

Hi scottpj,

Which is the exact error message you get?

Thanks in advance.
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

scottpj
Newbie
Newbie
Posts: 17
Joined: Mon May 15, 2006 12:00 am

Posted under a different thread 7.08 and 7.07 C++ example co

Post by scottpj » Mon Jul 10, 2006 1:50 pm

7.08 and 7.07 C++ example code compile failure

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 Jul 10, 2006 1:55 pm

Hi scottpj,

Ok, thanks for the information. We are looking into this and we will get back to you when we have further news.
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

scottpj
Newbie
Newbie
Posts: 17
Joined: Mon May 15, 2006 12:00 am

Additional information about missing files

Post by scottpj » Mon Jul 10, 2006 2:06 pm

I noticed that you had a file called Base.cpp and Base.hpp.

In them I found your declaration of global variables, of which I am using Chart1, which are needed for EditChart().

Looking at the include files I see several files that I am not seen before.
From the labeling several appear to be yours, Te*.hpp. As for others I am not sure. Any clarification as to what files are needed for each include files/library feature that a programmer may be interested in and what global variables that will be required would be helpful.

Thank in advance for the help.

scottpj
Newbie
Newbie
Posts: 17
Joined: Mon May 15, 2006 12:00 am

[Solved] Title work as advertised

Post by scottpj » Thu Jul 13, 2006 1:39 pm

It appears that the problem is due to an errant usage of a variable as a pointer.

The fix was to change my code from using separate statement for X and Y value to a single statement.

From
Series1->XValue[LoopCnt] = UIValues.V;
Series1->YValue[LoopCnt] = UIValues.V;

To
Series1->AddXY(XValue,YValue ,"",clTeeColor);

While I was in a for loop I checked for which variable need to be "saved" for plotting which implied a single statement. So I setup a XValue and YValue locally and use the above statement instead.

The affect of the single statements appears to be as an address instead of as a value.

Here is the code so far that is working for me:
// begin a line of data into the table
Series1->Clear();
DBChart1->Axes->Bottom->LabelsAngle = 90;
DBChart1->Axes->Bottom->AxisValuesFormat = "0.00e-0";
DBChart1->Axes->Bottom->Logarithmic = false; // True or False
DBChart1->Axes->Bottom->LogarithmicBase = 10; // 10 or e
DBChart1->Axes->Bottom->Title->Caption = XName + " (" + XUnit + ")";
DBChart1->Axes->Left->AxisValuesFormat = "0.00e-0";
DBChart1->Axes->Left->Logarithmic = false; // True or False
DBChart1->Axes->Left->LogarithmicBase = 10; // 10 or e
DBChart1->Axes->Left->Title->Caption = YName + " (" + YUnit + ")";
DBChart1->Title->Clear();
StrFormat = XName + " Vs " + YName;
DBChart1->Title->Text->Add(StrFormat);
Series1->Title = StrFormat;
StrFormat = XUnit + " Vs " + YUnit;
DBChart1->Title->Text->Add(StrFormat);

Thanks for the time and effort in helping me and for the hints as to what to try.

Post Reply