Page 1 of 1

Exact Axis Length on Paper

Posted: Tue Mar 02, 2004 8:36 am
by 6930853
Hi,
I am trying to adjust the length of the graph axes on the paper,
when the graph is printed out from some printer device.
For example, I would like to set the X axis length on the paper
exactly to 10cm and the Y axis length exactly to 15cm.
The problem is that the printed out axes' lengths depend on the
label strings when the margins are used for the length adjustment.

So, here are my questions:
Q1. Is it possible to directly control the axis length by means of the
actual length on the printed-out paper?

Q2. Is there some way to know the axis length (in pixel units?)
of the on-memory image before the graph is printed out?

I would appreciate any help or suggestion.
Thank you.

Posted: Mon Mar 08, 2004 9:46 am
by Chris
Hi --
So, here are my questions:
Q1. Is it possible to directly control the axis length by means of the
actual length on the printed-out paper?

Q2. Is there some way to know the axis length (in pixel units?)
of the on-memory image before the graph is printed out?
Well, what you can do is specify the chart panel margins in pixels rather than a percentage of the chart panel area:

Code: Select all

tChart1.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
tChart1.MarginLeft = 10; // <--- 10 pixels
You can then determine the length of the axis before exporting to an image (or before printing) using code similar to the following:

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e) {
			tChart1.Aspect.View3D = false;
			bar1.FillSampleValues();
			bar1.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Both;
			tChart1.Axes.Right.AxisPen.Width = 1;
			tChart1.Axes.Right.Labels.Visible = false;
		}


		private void button1_Click(object sender, System.EventArgs e) {
			int bAxisLength = tChart1.Axes.Right.Position - tChart1.Axes.Left.Position;
			label1.Text = bAxisLength.ToString();
			tChart1.Export.Image.PNG.Save(@"C:\TEMP\axis.png");
		}