Individual styling of labels in axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Calzone
Newbie
Newbie
Posts: 3
Joined: Wed Mar 29, 2017 12:00 am

Individual styling of labels in axis

Post by Calzone » Thu Apr 27, 2017 12:34 pm

Is there a way to make some of the labels in the y-axis bold/larger font? (To create group headers.)


Using TChart android in xamarin.

Calzone
Newbie
Newbie
Posts: 3
Joined: Wed Mar 29, 2017 12:00 am

Re: Individual styling of labels in axis

Post by Calzone » Thu Apr 27, 2017 12:44 pm

Edit: using gantt chart

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Individual styling of labels in axis

Post by Sandra » Fri Apr 28, 2017 4:43 pm

Hello Calzone,

The code below shows you how can change each axis label:

Code: Select all

        tChart1.Axes.Left.Labels.Items[0].Font.Bold = true;
        tChart1.Axes.Left.Labels.Items[1].Font.Size = 15;
Hoping this helps you, otherwise don't hesitate to contact us.

Thanks in advances
Best Regards,
Sandra Pazos / 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

Calzone
Newbie
Newbie
Posts: 3
Joined: Wed Mar 29, 2017 12:00 am

Re: Individual styling of labels in axis

Post by Calzone » Tue May 02, 2017 8:18 am

Hi

Thanks for the reply.

In my app the "chart.Axes.Left.Labels.Items.count" is 0. ( after chart.Series.Add(gantt);)
I do not explicitly add any labels, Its labels from "gantt.Add(pkt.FromDate, pkt.ToDate, pkt.Order, pkt.Name);" I wish to highlight based om some property.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Individual styling of labels in axis

Post by Sandra » Tue May 02, 2017 11:51 am

Hello Calzone,

Sorry, I didn't inform you that is necessary use CustomLabels to get the result you expected. I have modified the above code to do as you want.

Code: Select all

      public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private void InitializeChart()
        {
            Steema.TeeChart.Styles.Gantt gantt = new Steema.TeeChart.Styles.Gantt(tChart1.Chart);
            gantt.FillSampleValues(10);
            tChart1.Axes.Left.Labels.Items.Clear();
            for (int i=0; i<gantt.Count; i++)
            {
                tChart1.Axes.Left.Labels.Items.Add(gantt.YValues[i], gantt.Labels[i]);
                if (i%2==0)
                {
                    tChart1.Axes.Left.Labels.Items[i].Font.Bold = true;
                }
                else
                {
                    tChart1.Axes.Left.Labels.Items[i].Font.Size = 12;
                }
            }
        }
Could you tell us if it now works in your end?

Hoping this helps you.
Thanks in advance
Best Regards,
Sandra Pazos / 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