Hi,
I am Tchart5x user.
I have a requirement in which I need to show the point labels in different fonts.
I am able to set the different colors using .Series(0).PointColor(0) property.
Is there any way to set different fonts for the points ?
Thanks,
Kailas
Assign different fonts to the Points Labels on Line Graph
Re: Assign different fonts to the Points Labels on Line Graph
Hi Kalias,
I'm afraid this is not possible since the font property is a property for the whole series (TChart1.Series(0).Marks.Font) not for each value.
What you could do is to draw your text directly to the canvas like in the following example:
I'm afraid this is not possible since the font property is a property for the whole series (TChart1.Series(0).Marks.Font) not for each value.
What you could do is to draw your text directly to the canvas like in the following example:
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.Legend.Visible = False
TChart1.AddSeries scPoint
For i = 0 To 19
TChart1.Series(0).Add Rnd * 100, "point nº" + Str$(i), clTeeColor
Next i
TChart1.Series(0).Marks.Font
End Sub
Private Sub TChart1_OnAfterDraw()
Dim i As Integer
For i = 0 To TChart1.Series(0).Count - 1
TChart1.Canvas.Font.Size = (i Mod 10) + 10
TChart1.Canvas.TextOut TChart1.Series(0).CalcXPos(i), TChart1.Series(0).CalcYPos(i), TChart1.Series(0).PointLabel(i)
Next i
End Sub
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Assign different fonts to the Points Labels on Line Graph
I have requirement where I want to draw Rectangle around a text which I am plotting with help from you previously.
Can you help on this ?
Also I need to draw the text in between two point. I have attached attachment for more details.
Values used for this :
Thanks,
CS
Can you help on this ?
Also I need to draw the text in between two point. I have attached attachment for more details.
Values used for this :
Thanks,
CS
Re: Assign different fonts to the Points Labels on Line Graph
Hello CS,
I have made a simple example for you using rectangle tool. Please check if next code works as you want:
I hope will helps.
Thanks,
I have made a simple example for you using rectangle tool. Please check if next code works as you want:
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.Legend.Visible = False
TChart1.AddSeries scLine
TeeCommander1.Chart = TChart1
For i = 0 To 19
TChart1.Series(0).Add Rnd * 100, "point nº" + Str$(i), clTeeColor
Next i
TChart1.Environment.InternalRepaint
End Sub
Private Sub TChart1_OnAfterDraw()
Dim i As Integer
TChart1.Tools.Clear
For i = 0 To TChart1.Series(0).Count - 1
TChart1.Canvas.Font.Size = (i Mod 10) + 10
With TChart1
.Tools.Add tcRectangle
.Tools.Items(i).asRectangle.Shape.CustomPosition = True
.Tools.Items(i).asRectangle.AutoSize = True
.Tools.Items(i).asRectangle.Shape.Transparency = 30
.Tools.Items(i).asRectangle.Left = .Series(0).CalcXPos(i)
.Tools.Items(i).asRectangle.Top = .Series(0).CalcYPos(i)
.Tools.Items(i).asRectangle.Text = TChart1.Series(0).PointLabel(i)
End With
Next i
End Sub
Private Sub TChart1_OnScroll()
TChart1.Environment.InternalRepaint
End Sub
Private Sub TChart1_OnUndoZoom()
TChart1.Environment.InternalRepaint
End Sub
Private Sub TChart1_OnZoom()
TChart1.Environment.InternalRepaint
End Sub
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Assign different fonts to the Points Labels on Line Graph
Hi ,
version 5 in which I don't see tcRectangle and TCommander
used "TeeChart5Activex.exe" for installation. We are calling the tchart componets from VB 6.
Thanks
CS
version 5 in which I don't see tcRectangle and TCommander
used "TeeChart5Activex.exe" for installation. We are calling the tchart componets from VB 6.
Thanks
CS
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Assign different fonts to the Points Labels on Line Graph
Hi CS,
TeeCommander is not relevant for the example. You can use Annotation tools instead of Rectangle tools in v5 then. They work pretty much the same way.
TeeCommander is not relevant for the example. You can use Annotation tools instead of Rectangle tools in v5 then. They work pretty much the same way.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |