Page 1 of 1

Axis title gets trimmed

Posted: Wed Aug 14, 2013 10:41 am
by 15664347
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

Re: Axis title gets trimmed

Posted: Wed Aug 14, 2013 12:04 pm
by 10050769
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,