Labels in Barchart Bottom axis

TeeChart for ActiveX, COM and ASP
Post Reply
OW
Newbie
Newbie
Posts: 2
Joined: Wed Aug 08, 2001 4:00 am

Labels in Barchart Bottom axis

Post by OW » Thu Jun 29, 2006 10:13 pm

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

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

Post by Pep » Wed Jul 05, 2006 3:07 pm

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

OW
Newbie
Newbie
Posts: 2
Joined: Wed Aug 08, 2001 4:00 am

Post by OW » Thu Jul 06, 2006 10:21 am

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jul 06, 2006 10:46 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

JimmyG
Newbie
Newbie
Posts: 4
Joined: Mon Jun 07, 2004 4:00 am

Post by JimmyG » Tue Dec 05, 2006 9:13 pm

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? :?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Dec 11, 2006 2:45 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply