TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
neo
- Newbie
- Posts: 17
- Joined: Tue Jul 19, 2005 4:00 am
Post
by neo » Tue Aug 29, 2006 5:24 pm
Hello,
I've just taken over some code from someone who left the company. I'm fairly new to using the TTeeChart components. I have a problem where a flat line continuously gets draw along 0 on the vertical axis. The code is fairly straightforward...
Code: Select all
acurve := TLineSeries.Create(Chart1);
*for loop*
acurve.AddXY(xvalue, yvalue);
*end loop*
with acurve do
begin
VertAxis := aLeftAxis;
HorizAxis := aBottomAxis;
ParentChart := Chart1;
LinePen.Width := 3;
end;
with acurve.Pointer do
begin
Visible := true;
HorizSize := 4;
VertSize := 4;
Style := psRectangle
end;
the x axis appears to be plotted correctly but the y axis is always flat. The *for loop* above is fine, i just wanted to reduce the code in this post. it can go through the loop any number of times, it depends on how many points there are to plot. I've traced it and every point is valid. Why does it always appear flat.
Thanks
-
Marjan
- Site Admin
- Posts: 745
- Joined: Fri Nov 07, 2003 5:00 am
- Location: Slovenia
-
Contact:
Post
by Marjan » Wed Aug 30, 2006 5:39 am
Hi.
Which TeeChart and Delphi version are you using ? Perhaps the problem is left axis automatic scaling was accidentally disabled at design time. Try reseting it with the following code:
Code: Select all
acurve.GetVertAxis.Automatic := true;
Also, check if all yvalues are not the same. Another thing to check is if acurve series is actually "connected" to chart i.e. if it's ParentChart property is set to Chart1:
Code: Select all
acurve := TLineSeries.Create(Chart1);
acurve.ParentChart := Chart1;
-
neo
- Newbie
- Posts: 17
- Joined: Tue Jul 19, 2005 4:00 am
Post
by neo » Wed Aug 30, 2006 8:03 pm
Hi Marjan,
Thanks. The first suggestion was the problem.
Cheers