Bottom Labels Overlapping

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Avatar
Newbie
Newbie
Posts: 26
Joined: Mon Mar 22, 2004 5:00 am
Location: Calgary Canada
Contact:

Bottom Labels Overlapping

Post by Avatar » Fri Nov 05, 2004 5:49 pm

I have installed the latest version of TeeChart.Net Nov 2004. I was waiting for this release so the year labels would relate to the data. This is done and it looks great. Now my problem is the lables overlap when a large number of years are displayed.

Is there a way to display say every fifth label. The Grid is fine on Yearly incraments. Tried 'TChart1.Axes.Bottom.Labels.Separation ' didn't work.

TChart1.Axes.Bottom.Labels.DateTimeFormat = "yy" is still to crowded and TChart1.Axes.Bottom.Labels.Angle = 90 is not an option.

if I drop TChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneYear) It looks OK but again the labels would not relate to the data.



Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim StartDate As New DateTime(1962, 1, 1)
Dim PointDate As New DateTime(1962, 1, 1)
Dim x As Single
Dim EnderDate As New DateTime(2010, 1, 1)
TChart1.Legend.Visible = False
For i As Integer = 1 To 360
x = x + Rnd()
Line1.Add(PointDate, x, "")
PointDate = PointDate.AddMonths(1)
Next
Line1.XValues.DateTime = True
TChart1.Axes.Bottom.Automatic = False
TChart1.Axes.Bottom.Labels.Separation = 10
TChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneYear)
TChart1.Axes.Bottom.Labels.DateTimeFormat = "yyyy"
TChart1.Axes.Bottom.SetMinMax(StartDate, EnderDate)
End Sub

Thanks

Avatar
Newbie
Newbie
Posts: 26
Joined: Mon Mar 22, 2004 5:00 am
Location: Calgary Canada
Contact:

Post by Avatar » Sat Nov 06, 2004 5:14 pm

I saw this in one of the other posts

private void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
{
if ((Steema.TeeChart.Axis)sender==tChart1.Axes.Bottom)
e.LabelText = e.LabelText + " .";
}

I can't figure out the VB.Net equivalent code. Will this work if I make every third label = ""

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

Post by Pep » Mon Nov 08, 2004 9:53 am

Hi Avatar,

you can use the folowing code (it will show every third axis label) :

Code: Select all

Private Sub TChart1_GetAxisLabel(ByVal sender As Object, ByVal e As Steema.TeeChart.GetAxisLabelEventArgs) Handles TChart1.GetAxisLabel
    If (CType(sender, Steema.TeeChart.Axis) Is TChart1.Axes.Bottom) Then
        If (Convert.ToInt16(e.LabelText).ToString() Mod 3 <> 0) Then
            e.LabelText = ""
        End If
    End If
End Sub
Also, There are even a couple of free translation tools :
tool #1: http://www.aspalliance.com/aldotnet/exa ... slate.aspx

tool #2: http://www.kamalpatel.net/ConvertCSharp2VB.aspx

Avatar
Newbie
Newbie
Posts: 26
Joined: Mon Mar 22, 2004 5:00 am
Location: Calgary Canada
Contact:

Post by Avatar » Mon Nov 08, 2004 2:21 pm

Thanks Josep,
The chart looks great. I tried the links for the converter C# to VB.net.

Post Reply