Annotation tool which follows a curve when scrolled/zoomed

TeeChart for ActiveX, COM and ASP
Post Reply
tdm
Newbie
Newbie
Posts: 22
Joined: Fri Oct 22, 2004 4:00 am
Location: mérignac, france
Contact:

Annotation tool which follows a curve when scrolled/zoomed

Post by tdm » Tue Feb 15, 2005 11:05 am

Hi !
I would like to know how I could do to draw a text on a curve and to refresh the position of this text when the graph is zoomed or scrolled in order this text to stay a the same X and Y (not in pixels but in axis units) position.
These X and Y co-ordinates are not necessary the coordinates of a point in the series the chart displays.
Exemple : I would like to place the upper left corner of the text box at the pixel of my curve which has the (3.578; 4.587) coordinates in the current graph, relatively to its current axes. If the graph is scrolled, the text must stay at the (3.578; 4.587) coordinates and stack the curve. The pixel corresponding coordinates must be recalculated but how ?
[img]file://c:\chart.jpg[/img]<- Hey how could I send you an image to show you what I want to do ?
Thanks for your reply

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 Feb 15, 2005 11:33 am

Hi tdm,

Please post the image at the steema.public.attachments newsgroup available at news://www.steema.net.

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

tdm
Newbie
Newbie
Posts: 22
Joined: Fri Oct 22, 2004 4:00 am
Location: mérignac, france
Contact:

Post by tdm » Tue Feb 15, 2005 1:15 pm

Explanations and pictures have been posted in the steema.public.attachements newsgroup.
Could you have a watch to them ?
Thanks a lot.

tdm
Newbie
Newbie
Posts: 22
Joined: Fri Oct 22, 2004 4:00 am
Location: mérignac, france
Contact:

Post by tdm » Wed Feb 16, 2005 1:20 pm

Hey !
what's the matter ?
Does nobody knows how to solve my problem ?
Please have a look to the newsgroups (steema.public.attachments). The topic is Annotation Tool which follows a curve when scrolled/zoomed. There are 3 pictures which show what I want to do.
Thanks fo your help.

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 Feb 16, 2005 2:57 pm

Hi tdm,

Please find attached an example project at the newsgroups.

The Annotation Tool position is computed in the OnBeforeDrawAxes event using:

Code: Select all

Private Sub TChart1_OnBeforeDrawAxes()
With TChart1.Tools.Items(0).asAnnotation.Shape
    .CustomPosition = True
    .Top = TChart1.Series(0).CalcYPos(2)
    .Left = TChart1.Series(0).CalcXPos(2)
  End With
End Sub
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

tdm
Newbie
Newbie
Posts: 22
Joined: Fri Oct 22, 2004 4:00 am
Location: mérignac, france
Contact:

Post by tdm » Wed Feb 16, 2005 4:31 pm

Thanks a lot !
I will studdy it immediately and I'll give you a feedback as soon as I can.

tdm
Newbie
Newbie
Posts: 22
Joined: Fri Oct 22, 2004 4:00 am
Location: mérignac, france
Contact:

Post by tdm » Wed Feb 16, 2005 4:54 pm

This program draws the annotation with its upper left corner on the 2nd point of the serie isn't it ?
What if I want to put the upper left corner on a pixel of a segment which joins 2 successive points of the serie (middle of segment for exemple) ?

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

Post by Narcís » Thu Feb 17, 2005 9:29 am

Hi tdm,
This program draws the annotation with its upper left corner on the 2nd point of the serie isn't it ?
Yes, that's it.
What if I want to put the upper left corner on a pixel of a segment
which joins 2 successive points of the serie (middle of segment for exemple) ?
You can do something like:

Code: Select all

Private Sub TChart1_OnBeforeDrawAxes()
With TChart1.Tools.Items(0).asAnnotation.Shape
    .CustomPosition = True
    .Top = (TChart1.Series(0).CalcYPos(2) + TChart1.Series(0).CalcYPos(3)) / 2
    .Left = (TChart1.Series(0).CalcXPos(2) + TChart1.Series(0).CalcXPos(3)) / 2
  End With
End Sub
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

tdm
Newbie
Newbie
Posts: 22
Joined: Fri Oct 22, 2004 4:00 am
Location: mérignac, france
Contact:

Post by tdm » Thu Feb 17, 2005 9:34 am

Yeah it's an idea.
I will take the X and Y of the two points which give the segment bounds, and compute the line equation to find the position of the annotation tool coordinates.
Thanks a lot for your help !

Post Reply