I need to display a number value that is passed as a variable on the canvas. I am know I can use “chart1.Canvas.TextOut” to display a text value but is it possible to pass a number and text value (ex. Avg = var1 var1 being a number variable).
Please help. An example will be greatly appreciated.
Thanks,
Ted
Displaying a number on canvas
Hi Ted,
you can do something like this :
you can do something like this :
Code: Select all
Dim value
Private Sub Form_Load()
value = 10 + 10
End Sub
Private Sub TChart1_OnAfterDraw()
TChart1.Canvas.TextOut 40, 40, Str(value)
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com
Thanks for the quick response.
I tried your recommended solution but it is not displaying the number on the canvas.
On the chart I am working with there are two series one is a line and the other is horizline. And the code I user to write on the canvas is as follows:
staticTtt.Canvas.Font.Name = staticTtt.Footer.Font.Name
staticTtt.Canvas.Brush.Style = 0
staticTtt.Canvas.TextOut (staticTtt.Canvas.Left + _(staticTtt.Canvas.Width / 2)), (staticTtt.Canvas.Top + _(staticTtt.Canvas.Height / 2)), cstr(avgTtt)
avgTtt is a variable that is set and value assigned to it at an erlier stage of the code.
What am I missing?
Thanks again.
Ted
I tried your recommended solution but it is not displaying the number on the canvas.
On the chart I am working with there are two series one is a line and the other is horizline. And the code I user to write on the canvas is as follows:
staticTtt.Canvas.Font.Name = staticTtt.Footer.Font.Name
staticTtt.Canvas.Brush.Style = 0
staticTtt.Canvas.TextOut (staticTtt.Canvas.Left + _(staticTtt.Canvas.Width / 2)), (staticTtt.Canvas.Top + _(staticTtt.Canvas.Height / 2)), cstr(avgTtt)
avgTtt is a variable that is set and value assigned to it at an erlier stage of the code.
What am I missing?
Thanks again.
Ted
Hi Ted,
strange, here works as expected. I've sent one example to the steema.public.attachments newsgroup, could you please check if it works fine for you ?
strange, here works as expected. I've sent one example to the steema.public.attachments newsgroup, could you please check if it works fine for you ?
Pep Jorge
http://support.steema.com
http://support.steema.com