Page 1 of 1

Axis labels wont take font changes

Posted: Tue Mar 09, 2010 8:33 pm
by 9529272
Hi,

I have a problem with the font of the bottom axis labels. When I clear the label collection and add them myself, the font for those labels reset to a default font and size and cannot be changed.

Attached to the post there is a project I've built to show the problem.
The issue is found in TeeChart ActiveX Version 8.0.0.6 and 7.0.1.3

I really need to fix that problem, please advise what can I do about it.

Thanks in advance.

Re: Axis labels wont take font changes

Posted: Wed Mar 10, 2010 3:53 pm
by yeray
Hi OptUser,

I've reproduced it so I've added it to the defect list to be fixed in future releases (TV52014727). It seems that font changes aren't applied to the axis labels when using custom labels.

Re: Axis labels wont take font changes

Posted: Mon Mar 15, 2010 9:52 pm
by 9529272
Hi, thanks your response.

Can you suggest a workaround I can use meanwhile it is being fixed?
I need to define specific values for the bottom axis and the only way I could make it work is clearing the label list.

Re: Axis labels wont take font changes

Posted: Tue Mar 16, 2010 10:57 am
by yeray
Hi OptUser,

Of course, you always can draw text directly to the canvas. Here is an example:

Code: Select all

Private Sub Form_Load()  
  TChart1.Aspect.View3D = False
  
  TChart1.AddSeries scLine
  TChart1.Series(0).FillSampleValues 25
  
  TChart1.Axis.Bottom.Labels.Clear
  
  Dim i As Integer
  For i = 0 To TChart1.Series(0).Count - 1
    TChart1.Axis.Bottom.Labels.Add TChart1.Series(0).XValues.Value(i), " "
  Next i
End Sub

Private Sub TChart1_OnAfterDraw()
  Dim i As Integer
  With TChart1.Canvas
    .Font.Name = "Tahoma"
    .Font.Size = 7
    .Font.Bold = True
    .Font.Color = vbBlue
  
    For i = 0 To TChart1.Series(0).Count - 1
      .RotateLabel TChart1.Series(0).CalcXPos(i) - (.TextHeight("hello") / 2), TChart1.Axis.Bottom.Position + .TextWidth("hello") + TChart1.Axis.Bottom.TickLength, "hello", 90
    Next i
  End With
End Sub
Note that first of all, I've cleared the labels and added custom labels with the text " " to show the grids but not any text.