Axis title gets trimmed

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
OMP
Newbie
Newbie
Posts: 21
Joined: Mon Dec 10, 2012 12:00 am

Axis title gets trimmed

Post by OMP » Wed Aug 14, 2013 10:41 am

hi,

If I add a title to my left axis, where the title contains of multiple rows, the rows get cut off.

Here is my code:

Code: Select all

            tChart1.Axes.Left.Title.Text = "first row \n second row \n third row \n forth row \n fifth row";

            Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            line.Title = "Line series";
            for (int i = 1; i <= 20; ++i)
            {
                line.Add(i);
            }
See the attached screenshot for the result.

What can we do to make the title completely visible?

Thanks,
Marijke
Attachments
Capture.PNG
Capture.PNG (69.49 KiB) Viewed 4389 times

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

Re: Axis title gets trimmed

Post by Sandra » Wed Aug 14, 2013 12:04 pm

Hello OMP,

I suggest you use MesureString to get the size of string and increment Left axis by the size parameters. You can do something as next:

Code: Select all

 public Form1()
    {
      InitializeComponent(); 
      InitializeChart();
    }
    SizeF sizeTitle; 
    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
      tChart1.Axes.Left.Title.Text = "first row \n second row \n third row \n forth row \n fifth row";
      sizeTitle = tChart1.Graphics3D.MeasureString(tChart1.Axes.Left.Title.Font,tChart1.Axes.Left.Title.Text); 
     
      line.Title = "Line series";
      for (int i = 1; i <= 20; ++i)
      {
        line.Add(i);
      }
      button1.Click += button1_Click;
      tChart1.Draw();
      tChart1.Panel.MarginUnits = PanelMarginUnits.Pixels; 
      tChart1.Panel.MarginLeft = sizeTitle.Height + tChart1.Panel.MarginLeft; 
    }
    void button1_Click(object sender, EventArgs e)
    {
      tChart1.ShowEditor(); 
    }
Could you tell us if previous code works in your end?

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