Remove text after drawing 2D text on canvas
Posted: Thu Aug 11, 2022 2:16 pm
Hi,
I wanted to add some custom text on a curve, depending on the points values.
I made a rocedure called in the afterdraw event of the chart, as follows :
s is the Serie I want to track.
Problem : once the text is drawn (works well), is there any way to hide it or remove it ?
In some part of my project, the user can hide/show curves. If I hide the series "s", the text remains on the graph...
The part 13 of the tutorial explains how to draw things on the graph, but not how to erase them.
Any idea ?
Thanks
I wanted to add some custom text on a curve, depending on the points values.
I made a rocedure called in the afterdraw event of the chart, as follows :
Code: Select all
Public Sub label_water_valves(s As Steema.TeeChart.Styles.Series, e As Steema.TeeChart.Drawing.Graphics3DGdiPlus)
Dim X, Y, old As Double
Dim te = ""
Dim res As Integer
old = -1
For i As Integer = 0 To s.XValues.Count - 1
If s.YValues(i) > 0 And s.YValues(i) <> old Then
X = Main.TChart1.Axes.Bottom.CalcXPosValue(s.XValues(i))
Y = Main.TChart1.Axes.Left.CalcYPosValue(s.YValues(i))
res = HexStringToBinary(s.YValues(i))
If res And 4 Then te = te & "LP"
If res And 16 Then te = te & vbCrLf & "HP"
If res And 64 Then te = te & vbCrLf & "RSV"
e.TextOut(X, Y, te)
te = ""
old = s.YValues(i)
End If
Next
End Sub
Problem : once the text is drawn (works well), is there any way to hide it or remove it ?
In some part of my project, the user can hide/show curves. If I hide the series "s", the text remains on the graph...
The part 13 of the tutorial explains how to draw things on the graph, but not how to erase them.
Any idea ?
Thanks