Set chart inner left and width

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
icecream
Newbie
Newbie
Posts: 20
Joined: Thu Aug 07, 2008 12:00 am

Set chart inner left and width

Post by icecream » Wed Aug 05, 2015 3:08 pm

Hello,

I have a split container with three panels. Each panel contains a chart, which fills the entire area. Is there a way to make charts left and width the same? Playing with Width and Left properties does not make any effect.
Image

Thanks.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Set chart inner left and width

Post by Christopher » Thu Aug 06, 2015 8:43 am

Hello,
icecream wrote:Hello
You should be able to use the GetAxesChartRect event as shown in this simple example here.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

icecream
Newbie
Newbie
Posts: 20
Joined: Thu Aug 07, 2008 12:00 am

Re: Set chart inner left and width

Post by icecream » Fri Aug 07, 2015 3:33 pm

Thank you Cristopher!
I was able to do this with the following code:

Code: Select all

protected override void OnLoad(EventArgs e)
{
	base.OnLoad(e);
	chart2.Chart.GetAxesChartRect += chart23_GetAxesChartRect;
	chart3.Chart.GetAxesChartRect += chart23_GetAxesChartRect;
}

void chart23_GetAxesChartRect(object sender, Steema.TeeChart.GetAxesChartRectEventArgs e)
{
	Rectangle etalonRect = chart1.Chart.Chart.ChartRect;

	if (e.AxesChartRect.X != etalonRect.X || e.AxesChartRect.Width != etalonRect.Width)
	{
		Rectangle rect = new Rectangle();
		rect.X = etalonRect.X;
		rect.Y = e.AxesChartRect.Y;
		rect.Width = etalonRect.Width;
		rect.Height = e.AxesChartRect.Height;
		e.AxesChartRect = rect;
	}
}
However, I cannot understand why do X and Width not equal to etalon X and Width every time event handler is triggered? Chart1 size and position are the same.

Post Reply