Page 1 of 1
Chart Title Centering
Posted: Tue Nov 22, 2011 7:28 am
by 15660116
If I set TChart1.Header.Alignment=Alignment.Center, the title plots in the center of the teechart, but not centered between the x axis? See picture. The title position does not take into account the left margin of the chart, so the title is skewed to the left. This seems to be a bad bug to me. Why can't the title plot centered between the bottom axis ?
- ContTest2.jpg (115.26 KiB) Viewed 5169 times
Re: Chart Title Centering
Posted: Tue Nov 22, 2011 11:47 am
by narcis
Hi lilo,
Ok, I'll add your request to the wish-list (TV52015911) to be considered for inclusion in future releases. In the meantime you can manually center the title like this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Series.Add(new Steema.TeeChart.Styles.Bar()).FillSampleValues();
tChart1.Header.CustomPosition = true;
tChart1.Panel.MarginTop = 15;
this.tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
tChart1.Draw();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
SizeF size = g.MeasureString(tChart1.Header.Font, tChart1.Header.Text);
int length = tChart1.Axes.Bottom.IEndPos - tChart1.Axes.Bottom.IStartPos;
int x = tChart1.Axes.Bottom.IStartPos + (length / 2) - (int)(size.Width / 2);
tChart1.Header.Left = x;
tChart1.Header.Top = 10;
}