Page 1 of 1
ScrollPager and Custom axis, problem with margins
Posted: Fri Feb 14, 2014 12:05 pm
by 15654539
When I have in my chart scrollpager and also custom axis it is not possible to set the margin. Although I go to the chart editor and I put a very big margin it doesn't do anything.
Please find here an example. Press button1 to add scrollpager, and button4 to add custom margin
http://193.145.251.126/pnp/files/pycecb ... Scroll.zip
Thanks
Re: ScrollPager and Custom axis, problem with margins
Posted: Fri Feb 14, 2014 3:27 pm
by Christopher
wakeup wrote:When I have in my chart scrollpager and also custom axis it is not possible to set the margin. Although I go to the chart editor and I put a very big margin it doesn't do anything.
This can be ameliorated by code such as the following:
Code: Select all
private void button4_Click(object sender, EventArgs e)
{
Steema.TeeChart.Axis customAxis = new Steema.TeeChart.Axis(tChart1.Chart);
customAxis.Title.Visible = true;
customAxis.Visible = true;
customAxis.Automatic = true;
tChart1.Axes.Custom.Add(customAxis);
tChart1.Series[0].CustomVertAxis = customAxis;
//one possibility
//tChart1.Chart.CustomChartRect = false;
//tChart1.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
//tChart1.Panel.MarginLeft = 100;
//tChart1.Panel.MarginRight = 100;
//tChart1.Panel.MarginBottom = 200;
//another possibility
tChart1.Chart.CustomChartRect = true;
Rectangle rect = tChart1.Chart.ChartRect;
rect.X += 100;
tChart1.Chart.ChartRect = rect;
}
Re: ScrollPager and Custom axis, problem with margins
Posted: Fri Feb 14, 2014 3:59 pm
by 15654539
With the CustomChartRect = true; solution the chart is not resized automatically when the window is resized...
Re: ScrollPager and Custom axis, problem with margins
Posted: Fri Feb 14, 2014 4:26 pm
by Christopher
wakeup wrote:With the CustomChartRect = true; solution the chart is not resized automatically when the window is resized...
This is expected behaviour - when the tChart.Chart.ChartRect is not calculated automatically, that is, when CustomChartRect = true, the size of the chart remains at the size specified by tChart.Chart.ChartRect.
Re: ScrollPager and Custom axis, problem with margins
Posted: Fri Feb 14, 2014 4:29 pm
by 15654539
Where is CustomChartRect property in the chart editor?
Do you have any code to calculate the margins , and taking into account if the scrollpager is there or not?
Thanks
Re: ScrollPager and Custom axis, problem with margins
Posted: Fri Feb 14, 2014 4:37 pm
by Christopher
wakeup wrote:Where is CustomChartRect property in the chart editor?
It isn't the Chart Editor because it is considered an advanced property for use by the internal TeeChart code and experienced TeeChart developers. If you like, you could add it as an enhancement to
http://bugs.teechart.net/.
wakeup wrote:
Do you have any code to calculate the margins , and taking into account if the scrollpager is there or not?
Recalculating the margins can be done in the Resize event, as has been discussed in another recent thread.