Page 1 of 1
Set chart inner left and width
Posted: Wed Aug 05, 2015 3:08 pm
by 13049883
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.
Thanks.
Re: Set chart inner left and width
Posted: Thu Aug 06, 2015 8:43 am
by Christopher
Hello,
icecream wrote:Hello
You should be able to use the GetAxesChartRect event as shown in this simple example
here.
Re: Set chart inner left and width
Posted: Fri Aug 07, 2015 3:33 pm
by 13049883
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.