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) ThenmMovingAnnotation.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 chartresult = New nevG.NVector3DDDim 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
|
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
|
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) ThenmMovingAnnotation.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
|