How Do I Change X-Axis Labels to my own Customized Values?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

How Do I Change X-Axis Labels to my own Customized Values?

Post by Dave » Tue Mar 15, 2011 1:31 pm

Hi Support

Ive drawn a line chart and it looks very nice. The x-axis goes from 0 to 20 in steps of 1. However Id like to be able to change each of the x-axis labels.
Im sure this is simple but I cant work out how to do it? Can you explain?

For your information Ive tried

n = 0;
while(n < numberOfPoints)
{
myChart.Axes.Bottom.Labels.Items[n].Text = "my label";
++n;
}

but this doesn't work for n>=0. The collection has zero size.


We are using TeeChart for Net v3 and programming in C#.NET

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: How Do I Change X-Axis Labels to my own Customized Values?

Post by Yeray » Wed Mar 16, 2011 8:23 am

Hi Dave,

You have an example about it in the feature demo included with the instalaltion. At "All Features\Welcome !\Axes\Labels\Custom labels".
For example:

Code: Select all

            bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar1.FillSampleValues(7);

            tChart1.Axes.Bottom.Labels.Items.Clear();
            for (int i = 0; i < bar1.Count; i++)
            {
                if (i % 2 == 0)
                    tChart1.Axes.Bottom.Labels.Items.Add(bar1.XValues[i], "bar nº" + i.ToString());
            }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Re: How Do I Change X-Axis Labels to my own Customized Values?

Post by Dave » Wed Mar 16, 2011 4:11 pm

Thanks Yeray thats helped.

Post Reply