Page 1 of 1

TeeChart Pro6....Problem with vertical line...

Posted: Tue Oct 24, 2006 10:13 am
by 8577300
Hello Experts!!

I draw a line in the middle of a TeeChart like this at design-time (Axis --> Scaling: half step of the MIN-MAX-difference ...)

Image

I capture data from a sensor at realtime and want to show this data in the chart. But at runtime the labels of the bottom-axis and also the vertical line in the middle disappear like this...

Image

David Berneda recommended me to try a vertical line like this....

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var Middle : Integer;
begin
Middle:=(Chart1.BottomAxis.IStartPos+Chart1.BottomAxis.IEndPos) div 2;
Chart1.Canvas.DoVertLine(Middle,Chart1.LeftAxis.IStartPos,Chart1.LeftAxis.I­EndPos);
end;

But this line never appear at runtime!!

What do I make wrong?? :roll:
Bye
Thomas

Posted: Tue Oct 24, 2006 10:26 am
by narcis
Hi Thomas,

It works fine for me here using this code:

Code: Select all

procedure TForm8.Chart1AfterDraw(Sender: TObject);
var Middle : Integer;
begin
  Middle:=(Chart1.BottomAxis.IStartPos+Chart1.BottomAxis.IEndPos) div 2;
  Chart1.Canvas.DoVertLine(Middle,Chart1.LeftAxis.IStartPos,Chart1.LeftAxis.IEndPos);
end;

procedure TForm8.Timer1Timer(Sender: TObject);
begin
  Series1.Add(random*100);
end;
Could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.

Posted: Tue Oct 24, 2006 12:18 pm
by 8577300
Hello Narcis!!

Yes your sample-code works also great for me...
I send you my code to your newsgroup....also the settings of my tee-chart...I suggest that its a mistake by my settings in the chart...

Bye
Thomas

Posted: Tue Oct 24, 2006 3:11 pm
by narcis
Hi Thomas,

I'm not able to guess which can be the problem without being able to reproduce the problem here. You can try using the code below. It could be that labels overlap and are not displayed. The line below would force them being drawn.

Code: Select all

  Chart1.BottomAxis.LabelsSeparation:=0;
If the problem persists please try to arrange a simple example with random or manually added data we can run "as-is" to reproduce the problem here.

Thanks in advance.

Posted: Wed Oct 25, 2006 11:22 am
by 8577300
Hello Narcis!!

I'm on the way to solve my problem...what I found out is very simple:
I draw a black vertical line on a black background....*great shame* :oops:

I have 2 little questions they could help on:

+) Can I paint the vertical drawn line in other colors?? So that I have a green or red vertical line in the middle??
+) Can you give me a little code snip how to use TDateTime on the X-Axis?? (I want the format 'nn:ss')...

Bye
Thomas

Posted: Wed Oct 25, 2006 11:26 am
by 8577300
Ohh yes and I got my time in milliseconds...the time since the measure was started!!

Posted: Wed Oct 25, 2006 1:04 pm
by 8577300
The second question is solved....I got the data on the tee-chart and have also the vertical line in the middle. So is there a possibility to solve also the question with a line in the middle that have other color and thickness??!! :roll:

Posted: Wed Oct 25, 2006 1:09 pm
by narcis
Hi bingo72,

Yes, you need to set canvas pen's color an width:

Code: Select all

procedure TForm8.Chart1AfterDraw(Sender: TObject);
var Middle : Integer;
begin
  Middle:=(Chart1.BottomAxis.IStartPos+Chart1.BottomAxis.IEndPos) div 2;

  With Chart1.Canvas do
  begin
    Pen.Color:=clGreen;
    Pen.Width:=5;
    DoVertLine(Middle,Chart1.LeftAxis.IStartPos,Chart1.LeftAxis.IEndPos);
  end;
end;

procedure TForm8.FormCreate(Sender: TObject);
begin
  Series1.XValues.DateTime:=true;
  Chart1.Axes.Bottom.DateTimeFormat:='ss:nn';
end;

procedure TForm8.Timer1Timer(Sender: TObject);
begin
  Series1.AddXY(now,random*100);
end;

Posted: Wed Oct 25, 2006 2:02 pm
by 8577300
Thank you very much for your help!! :wink: