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

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bingo72
Newbie
Newbie
Posts: 42
Joined: Sun Aug 10, 2003 4:00 am
Location: Austria

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

Post by bingo72 » Tue Oct 24, 2006 10:13 am

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Oct 24, 2006 10:26 am

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.
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

bingo72
Newbie
Newbie
Posts: 42
Joined: Sun Aug 10, 2003 4:00 am
Location: Austria

Post by bingo72 » Tue Oct 24, 2006 12:18 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Oct 24, 2006 3:11 pm

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.
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

bingo72
Newbie
Newbie
Posts: 42
Joined: Sun Aug 10, 2003 4:00 am
Location: Austria

Post by bingo72 » Wed Oct 25, 2006 11:22 am

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

bingo72
Newbie
Newbie
Posts: 42
Joined: Sun Aug 10, 2003 4:00 am
Location: Austria

Post by bingo72 » Wed Oct 25, 2006 11:26 am

Ohh yes and I got my time in milliseconds...the time since the measure was started!!

bingo72
Newbie
Newbie
Posts: 42
Joined: Sun Aug 10, 2003 4:00 am
Location: Austria

Post by bingo72 » Wed Oct 25, 2006 1:04 pm

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:

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Oct 25, 2006 1:09 pm

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;
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

bingo72
Newbie
Newbie
Posts: 42
Joined: Sun Aug 10, 2003 4:00 am
Location: Austria

Post by bingo72 » Wed Oct 25, 2006 2:02 pm

Thank you very much for your help!! :wink:

Post Reply