Calculating pixel position of annotation callout
Posted: Sat Oct 30, 2010 5:12 am
I am using the following code to calculate the annotation callout of points on a ternary chart. I am getting the wrong screen coordinates output to the x and y positions of the callout. The result is a line connecting to empty point positions.
Sub PlotTernary
For i = 1 to numberofsamples
Ternary1.Add(XVal(i), YVal(i), ZVal(i), Color(i))
Next i
End Sub
Private Sub TChart1_ClickSeries(ByVal sender As Object, ByVal s As Steema.TeeChart.Styles.Series, ByVal valueIndex As Integer, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TChart1.ClickSeries
SetCallout(valueIndex)
End Sub
Private Sub SetCallout(ByVal AIndex As Integer)
AnnotationChart4.Active = True
' Change annotation text
AnnotationChart4.Shape.AutoSize = True
AnnotationChart4.Text = "Point: " & AIndex.ToString() & " Value: " & Ternary1.ValueMarkText(AIndex)
' Re-position annotation callout
With AnnotationChart4.Callout
.Visible = True
.XPosition = Ternary1.CalcXPos(AIndex)
.YPosition = Ternary1.CalcYPos(AIndex)
.ZPosition = 0
End With
End Sub
Sub PlotTernary
For i = 1 to numberofsamples
Ternary1.Add(XVal(i), YVal(i), ZVal(i), Color(i))
Next i
End Sub
Private Sub TChart1_ClickSeries(ByVal sender As Object, ByVal s As Steema.TeeChart.Styles.Series, ByVal valueIndex As Integer, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TChart1.ClickSeries
SetCallout(valueIndex)
End Sub
Private Sub SetCallout(ByVal AIndex As Integer)
AnnotationChart4.Active = True
' Change annotation text
AnnotationChart4.Shape.AutoSize = True
AnnotationChart4.Text = "Point: " & AIndex.ToString() & " Value: " & Ternary1.ValueMarkText(AIndex)
' Re-position annotation callout
With AnnotationChart4.Callout
.Visible = True
.XPosition = Ternary1.CalcXPos(AIndex)
.YPosition = Ternary1.CalcYPos(AIndex)
.ZPosition = 0
End With
End Sub