TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
OMP
- Newbie
- Posts: 21
- Joined: Mon Dec 10, 2012 12:00 am
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 (69.49 KiB) Viewed 4384 times
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
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,