Page 1 of 1

Labels in Barchart Bottom axis

Posted: Thu Jun 29, 2006 10:13 pm
by 6920343
Hi

We are using TeeChart 5.0.5.0 and have problems with long labels disappearing on the bottom axis in a barchart.

We've tried to put it on multiple lines, but the labels will then be clipped by the boundaries of the chart. Is there a automatic function to syllabify a label to the width of the bar while not pushing the text out of the activex control?

Example (VB6):

Private Sub TChart1_OnDblClick()

Dim l As Long

With TChart1

.RemoveAllSeries

.AddSeries scBar

.Series(0).Marks.Visible = False

For l = 1 To 5

.Series(0).Add l * 100, "Long Labeltext for bar no " & l, vbRed

Next l

End With

End Sub

Posted: Wed Jul 05, 2006 3:07 pm
by Pep
Hi,

there's not an automatic way to do this, the only way is to do it manually, using the OnGetAxisLabel event to divide the axis label. One way could be making use of the TeeSplitInLines method :

Code: Select all

Private Sub Form_Load()
TeeCommander1.Chart = TChart1
With TChart1
    .AddSeries scBar
    For i = 0 To 10
        .Series(0).AddXY i, Rnd * 100, "Current Listing" & i, clTeeColor
    Next i
    .Panel.MarginBottom = 10
End With
End Sub

Private Sub TChart1_OnGetAxisLabel(ByVal Axis As Long, ByVal SeriesIndex As
Long, ByVal ValueIndex As Long, LabelText As String)
With TChart1
If Axis = atBottom Then
    .Axis.Bottom.Labels.TeeSplitInLines LabelText, " "
End If
End With
End Sub

Posted: Thu Jul 06, 2006 10:21 am
by 6920343
Thanks Pep for your reply.

Yes this works as long as I only have one space (" "), but if the line breaks up in more than two (which often is the case) the labels are cropped and not entirely visible.

To illustrate: Try renaming you text to "My Current Listing" and making you Chart smaller.

Regars

Posted: Thu Jul 06, 2006 10:46 am
by narcis
Hi OW,

I can think of two options here:

1. Using another "line separator" like 2 blank spaces or another character you want:

Code: Select all

Private Sub Form_Load()
    With TChart1
        .AddSeries scBar
        For i = 0 To 10
            .Series(0).AddXY i, Rnd * 100, "My Current  Listing" & i, clTeeColor
        Next i
        .Panel.MarginBottom = 10
    End With
End Sub

Private Sub TChart1_OnGetAxisLabel(ByVal Axis As Long, ByVal SeriesIndex As Long, ByVal ValueIndex As Long, LabelText As String)
    With TChart1
        If Axis = atBottom Then
            .Axis.Bottom.Labels.TeeSplitInLines LabelText, "  "
        End If
    End With
End Sub
2. You can increase the chart's panel bottom margin.

Posted: Tue Dec 05, 2006 9:13 pm
by 9082767
Hello,

I've inherited a project that uses the TeeChart graph. It is all strictly asp with vbscripting. I'm having an issue with the bar graph multilines. I'm trying to use the TeeSplitinLines routine, but all the examples are showing to place it in a VB function. Where do I need to put this in an asp page? :?

Posted: Mon Dec 11, 2006 2:45 pm
by narcis
Hi JimmyG,

Please see the ASP Server Examples included with TeeChart's installtion. They are available at TeeChart's program group. Full sources are included as well.