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.
Modification of Line Plot Title using C++
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 [email protected]
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 [email protected]
Pep Jorge
http://support.steema.com
http://support.steema.com
I found the problem
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.
#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.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi scottpj,
Which is the exact error message you get?
Thanks in advance.
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 |
Instructions - How to post in this forum |
Posted under a different thread 7.08 and 7.07 C++ example co
7.08 and 7.07 C++ example code compile failure
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi scottpj,
Ok, thanks for the information. We are looking into this and we will get back to you when we have further news.
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 |
Instructions - How to post in this forum |
Additional information about missing files
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.
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.
[Solved] Title work as advertised
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.
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.