Chart Display with Vertical Bottom Axis Labels of Large Size

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Chart Display with Vertical Bottom Axis Labels of Large Size

Post by Neelam » Mon Jul 19, 2010 1:44 pm

Hi,

When I'm having a chart whose Labels are need to be displayed vertically and labels are very large. Charts in the grid (Y Axis) is not displayed properly. Is it possible to have a scroll bar so that user can see the chart properly.
Attachments
Labels Issue.zip
Bottm Axis Labels
(6.13 KiB) Downloaded 582 times

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

Re: Chart Display with Vertical Bottom Axis Labels of Large Size

Post by Sandra » Tue Jul 20, 2010 9:37 am

Hello Neelam,

I suggest two solutions that I think you can use in your application.

First, you can change the size of Margins Left, Right, Bottom or Top, using next line of code:

Code: Select all

tChart1.Panel.MarginLeft = 7;
It is an easy solution but it is not very elegant.

Second, I think that it is a best solution for you, because treat size of string label. See next example that demonstrate as string label.

Code: Select all

public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }

        private void InitializeChart()
        {

            Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            Random rnd = new Random();
            tChart1.Aspect.View3D = false;
            tChart1.Legend.Visible = false;
            bar1.ColorEach = true;
            bar1.Add(4, rnd.Next(100),"TESTESTETETETETEETETETETTESTESTETETETETEETETETET");
            bar1.Add(6, rnd.Next(100),"s");
            bar1.Add(7,rnd.Next(100),"s");
            bar1.Add(9,rnd.Next(100),"s");
            bar1.Marks.Visible = false;
            tChart1.Panel.MarginLeft = 7;
            tChart1.Axes.Left.Labels.Style = Steema.TeeChart.AxisLabelStyle.Mark;
            tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;
            bar1.GetSeriesMark +=new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(bar1_GetSeriesMark);
        }

        void bar1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
        {
            if (e.MarkText.Length > 20)
            {
                e.MarkText = e.MarkText.Substring(0, 10) + "...";
            }
        }
I hope will helps.

Thanks,
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