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
Annotation tool which follows a curve when scrolled/zoomed
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi tdm,
Please post the image at the steema.public.attachments newsgroup available at news://www.steema.net.
Thanks in advance.
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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi tdm,
Please find attached an example project at the newsgroups.
The Annotation Tool position is computed in the OnBeforeDrawAxes event using:
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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi tdm,
Yes, that's it.This program draws the annotation with its upper left corner on the 2nd point of the serie isn't it ?
You can do something like: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) ?
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 |
Instructions - How to post in this forum |