Page 1 of 1

axis labels

Posted: Wed Sep 28, 2005 5:58 pm
by 9088212
Hi,

I'm using Teechart Pro v6, Line graphic.
I have configured de style of the bottom axis to text.
Using the below command I set the label only for the first and the last point:
TChart1.Series(0).AddXY x, y, Text1.Text. vbRed

Because the labels are too long it is cutted by the sides of the component.
The left label should be left justified and the right label right justified.

Is there any property that assigns the alignmet mode?
Is there any possibility to align the labels individualy?

Posted: Thu Sep 29, 2005 10:11 am
by narcis
Hi,

I'm afraid what you request is not available. TChart1.Axis.Bottom.Labels.Align exists but I'd say this is not what you need. However you can achieve that custom drawing on TChart's canvas:

Code: Select all

Private Sub Form_Load()
    With TChart1.Series(0)
        .Add 12, "", vbRed
        .Add 13, "", vbRed
        .Add 16, "", vbRed
        .Add 11, "", vbRed
        .Add 17, "", vbRed
        .Add 12, "", vbRed
        .Add 17, "", vbRed
        
        .VerticalAxis = aBothVertAxis
    End With
End Sub

Private Sub TChart1_OnAfterDraw()
    Dim First, Last As String
    Dim Offset, CharSize As Integer
    
    First = "First Point Label"
    Last = "Last Point Label"
    Offset = 5
    CharSize = 6
    
    TChart1.Canvas.TextOut TChart1.Axis.Left.Position, _
                            TChart1.Axis.Bottom.Position + Offset, _
                            First
    
    TChart1.Canvas.TextOut TChart1.Axis.Right.Position - Len(Last) * CharSize, _
                            TChart1.Axis.Bottom.Position + Offset, _
                            Last  
End Sub