Exact Axis Length on Paper

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Steamer
Newbie
Newbie
Posts: 4
Joined: Wed Nov 19, 2003 5:00 am

Exact Axis Length on Paper

Post by Steamer » Tue Mar 02, 2004 8:36 am

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.

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Mon Mar 08, 2004 9:46 am

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");
		}
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply