Can anyone tell me why the below is happening please? The red line signifies where the annotation should be positioned (along X axis), but it's always rendered right on the left edge... I did a few searches in Google and SO, and found an answer which implies that PixelPositionToValue(Mouse.X)
would sort it, but even using this it ends up exactly the same.
Private Sub AssignNewDownTime()
Dim sStr As String = InputBox("Please enter downtime reason")
Dim annot As New Charting.RectangleAnnotation()
annot.ClipToChartArea = "Chart1"
annot.BackColor = Color.DarkRed
annot.ForeColor = Color.White
annot.AllowMoving = True
annot.AllowAnchorMoving = False
annot.AllowSelecting = False
annot.IsMultiline = False
annot.AllowTextEditing = False
annot.IsSizeAlwaysRelative = False
annot.X = Chart1.ChartAreas(0).AxisX.PixelPositionToValue(StartMousePoint.X)
annot.Y = 10
annot.Width = 25
annot.Text = sStr & " /X: " & annot.X & "Y:" & annot.Y
Chart1.Annotations.Add(annot)
Chart1.Invalidate()
End Sub