<pre>Private Sub Chart1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Chart1.MouseMove Dim result As HitTestResult = Chart1.HitTest(e.X, e.Y) If result.ChartElementType = ChartElementType.DataPoint Then ' Get getails from DataPoint. Dim department As String = result.Series.Name Dim Year As String = result.Series.Points(result.PointIndex).AxisLabel ' Dim NOA As String = result.Series.Points(result.PointIndex).AxisLabel Dim Total As Double = result.Series.Points(result.PointIndex).YValues(0) Dim thisPt As PointF = New PointF(Convert.ToSingle(result.Series.Points(result.PointIndex).XValue), Convert.ToSingle(result.Series.Points(result.PointIndex).YValues(0))) Dim ca As CalloutAnnotation = New CalloutAnnotation With { .AnchorDataPoint = result.Series.Points(result.PointIndex), .X = thisPt.X + 1, .Y = thisPt.Y + 1, .CalloutStyle = CalloutStyle.SimpleLine, .ForeColor = Color.Coral, .Font = New Font("Tahoma", 9, FontStyle.Bold), .Name = department, .Text = Year & " - " & department & Total } Chart1.Annotations(department) = ca Chart1.Invalidate() End If End Sub
Chart1.Annotations.Clear()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)