BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Strange Error when plotting data with TChart

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Tue May 01, 2007 11:58 pm    Post subject: Strange Error when plotting data with TChart Reply with quote



I have a TChart and one button in a project. The button just plots
points to the chart. If I call the AddXY() function it bombs if the
data is from an array created outside this routine or it bombs if the
"Y" data is a constant like dVal = 18100. NOTE: If the dVal = 1817 it
won't bomb, if dVal = 1818 it will bomb.
( dVal = 0x71A; //0x71A (1818)fails //0x719 (1817) passes )

Any ideas why this occurs? The only difference I can see is that one
is calculated on the fly and the other is known by the compiler at
compile time(this doesn't explain why dVal < 1817 passes but dVal >=
1818 fails though)
Thanks...

void __fastcall TForm1::Button2Click(TObject *Sender)
{
int i;
int iVal;
double dVal;

//dVal = 18180; // Bombs, when used
for(i=0;i<10000;i++)
{
//dVal = 8000; // Bombs, when used
//dVal = i*sin(i*3.14/360); // Works, when used
tcDataPlot->Series[0]->AddXY(i,dVal,"",clBlue); //i,10000,"",
clBlack);
}

}

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

"Access violation at address 40901083 in module 'tee60.bpl'. Write of
address 01754000"

"Project test.exe raised exception class EInvalidPointer with message
'Invalid pointer operation'. Process stopped"
Back to top
Clayton Arends
Guest





PostPosted: Thu May 03, 2007 10:55 pm    Post subject: Re: Strange Error when plotting data with TChart Reply with quote



I own TeeChart pro 7 so I don't know if you are experiencing a bug in the
standard version. With that in mind I tested your code by creating a new
application. I dropped a TChart on the form, added a "point" series,
dropped a button and added the following to the button handler:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
TChartSeries* series = Chart1->Series[0];
series->Clear();

double dVal;
for (int i = 0; i < 10000; ++i)
{
dVal = i * sin(i * 3.14 / 360);
series->AddXY(i, dVal, "", clBlue);
}
}

This code worked fine as well as any value I used for dVal including 18100
and 1818. Have you altered the chart settings in any way? If so, please
copy the chart from the IDE and paste it into your reply so that I can see
the object code for the chart.

Note, I also tried the above using a "line" series instead of the "point"
series with no problems.

- Clayton

PS - borland.public.cppbuilder.language.cpp is not the best newsgroup for
questions such as this. For future questions on TeeChart you should post to
borland.public.cppbuilder.vcl.components.using,
borland.public.cppbuilder.thirdpartytools, or post to Steema's forums at
http://steema.com. Steema is the company that makes TeeChart.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.