'Draws a horizontal line at the given y value
'A text can be displayed
'y = y value
'Color = color of the line and the text
'Stroke = line thickness in pixels
'Text = text to draw
'Align = alignment
' "LEFT" aligned
' "CENTER" in the center
' "RIGHT" aligned
' "NONE" no text drawn
Sub DrawHorizontalLineText(G As Graph, BD As BarData, y As Double, Color As Int, Stroke As Float, Text As String, Align As String)
Dim x1, x2, y1 As Float
x1 = G.GI.originX
x2 = G.GI.originX + G.GI.gw
y1 = G.GI.maxY + (G.YEnd - y) * G.GI.gh / (G.YEnd - G.YStart)
BD.Canvas.DrawLine(x1, y1, x2, y1, Color, Stroke)
Select Align
Case "LEFT"
BD.Canvas.DrawText(Text, x1 - 2dip, y1 + 4dip, Typeface.DEFAULT, 12, Color, "RIGHT")
Case "CENTER"
BD.Canvas.DrawText(Text, (x1 + x2) / 2, y1 - 2dip, Typeface.DEFAULT, 12, Color, "CENTER")
Case "RIGHT"
BD.Canvas.DrawText(Text, x2 + 2dip, y1 + 4dip, Typeface.DEFAULT, 12, Color, "LEFT")
End Select
BD.Target.Invalidate
End Sub