I m trying to change the marker image of plotted data points when a user hovers on a datapoint. The code i shown below:
The data point has been changing image when hovered on it but didn't change it back to "Red.png"?
Could anyone figure out why this is not happening?
Thanks.
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
Chart1.Series(0).Points(result.PointIndex).MarkerImage = "Green.png"
ElseIf result.ChartElementType = ChartElementType.PlottingArea Then
Chart1.Series(0).MarkerImage = "Red.png"
End If
End Sub
I figureed out that: Changing these lines
ElseIf result.ChartElementType = ChartElementType.PlottingArea Then
Chart1.Series(0).MarkerImage = "Red.png"
To
ElseIf result.ChartElementType = ChartElementType.PlottingArea Then
For i = 0 To Chart1.Series(0).Points.Count - 1
Chart1.Series(0).Points(i).MarkerImage = "Red.png"
Next
Worked...