Profile Picture

How to move an annotation?

Posted By Clara Lau 14 Years Ago
Author
Message
Clara Lau
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 2, Visits: 1

Hi,

I would like to move an existing annotation to a new location with the pointer still pointing at the same point on the graph. Is ArrowLength the property I need to change? If so, I would like to keep the anchor, but change the arrow length. Depends on the new location, the arrow length will lengthen and shorten dynamically. How would I do that? Here's my code:

 

Dim currentAnchor As nev.NScalePointAnchor = CType(mMovingAnnotation.Anchor, nev.NScalePointAnchor)

If transformViewToData(currentAnchor.VertAxisIndex, e.X, e.Y, scalePoint) Then

mMovingAnnotation.Anchor = New nev.NScalePointAnchor(Me.chart, nev.StandardAxis.PrimaryX, currentAnchor.VertAxisIndex, nev.StandardAxis.Depth, False, scalePoint)

mMovingAnnotation.ArrowLength = New Nevron.GraphicsCore.NLength(10, Nevron.GraphicsCore.NRelativeUnit.ParentPercentage)

Me.ChartControl.Refresh()

End If

******************************************************

Private Function transformViewToData(ByVal verticalAxisIndex As Integer, ByVal x As Integer, ByVal y As Integer, ByRef result As nevG.NVector3DD) As Boolean

' transforms a click point to a point with coords scaled to a specific Y Axis on the chart

result = New nevG.NVector3DD

Dim ptViewPoint As New nevG.NPointF(CSng(x), CSng(y))

Dim viewToScale As New nev.NViewToScale3DTransformation(Me.ChartControl.View.Context, Me.chart, nev.StandardAxis.PrimaryX, verticalAxisIndex, nev.StandardAxis.Depth, 0.0)

Return viewToScale.Transform(ptViewPoint, result)

End Function

 

Thanks,

Clara



Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Clara,

Yes you can use the arrow length and orientation properties to define an offset from the pivot point in polar coordinates. Generally the point pointed from:

x = pivot.x + cos(orientation) * arrowlength
y = pivot.y + sin(orientation) * arrowlength

is the middle of the label. Why do you need that feature? - we can add a secondary anchor to annotation if it is useful...



Best Regards,
Nevron Support Team



Clara Lau
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 2, Visits: 1

Hi,

Thanks for the reply.

Where do I put these offsets?

Dim newX As Integer = CInt(mMovingAnnotation.Pivot.X + Math.Cos(mMovingAnnotation.Orientation) * 10)

Dim newY As Integer = CInt(mMovingAnnotation.Pivot.Y + Math.Cos(mMovingAnnotation.Orientation) * 10)

Do I need to change the anchor of the annotation? I tried the following but the entire annotation moved, the pointer moved and pointing to a different location.

If transformViewToData(currentAnchor.VertAxisIndex, newX, newY, scalePoint) Then

mMovingAnnotation.Anchor = New nev.NScalePointAnchor(Me.chart, nev.StandardAxis.PrimaryX, currentAnchor.VertAxisIndex, nev.StandardAxis.Depth, False, scalePoint)

Me.ChartControl.Refresh()

End If

 

Where should I use the new offsets? And what about the arrowLength and Orientation? What should I set them to?

 

Thanks,

Clara

 





Similar Topics


Reading This Topic