Displaying a number on canvas

TeeChart for ActiveX, COM and ASP
Post Reply
TedK
Newbie
Newbie
Posts: 6
Joined: Tue Oct 09, 2001 4:00 am

Displaying a number on canvas

Post by TedK » Mon Mar 01, 2004 3:21 pm

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

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Mar 01, 2004 3:37 pm

Hi Ted,

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

TedK
Newbie
Newbie
Posts: 6
Joined: Tue Oct 09, 2001 4:00 am

Post by TedK » Tue Mar 02, 2004 2:06 pm

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

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Mar 03, 2004 4:17 pm

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 ?

Post Reply