Page 1 of 1

Individual styling of labels in axis

Posted: Thu Apr 27, 2017 12:34 pm
by 17380624
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.

Re: Individual styling of labels in axis

Posted: Thu Apr 27, 2017 12:44 pm
by 17380624
Edit: using gantt chart

Re: Individual styling of labels in axis

Posted: Fri Apr 28, 2017 4:43 pm
by 10050769
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

Re: Individual styling of labels in axis

Posted: Tue May 02, 2017 8:18 am
by 17380624
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.

Re: Individual styling of labels in axis

Posted: Tue May 02, 2017 11:51 am
by 10050769
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