Custom Axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
history
Newbie
Newbie
Posts: 29
Joined: Tue May 22, 2007 12:00 am

Custom Axis

Post by history » Tue Apr 15, 2008 5:18 pm

I have a strip chart, Similiar to the Permenant custom axis example, with the top being my left axis and the one below it being a custom axis.

The Y labels on the top axis go from 100 - 300
The Y labels on the custom axis go from 10,000 - 30,000

The left margin is not being adjusted to display all the digits in the custom axis.

Thanks

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Apr 16, 2008 7:58 am

Hi history,

You can try setting left margin like this:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();			
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			Steema.TeeChart.Styles.Line line2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);

			Steema.TeeChart.Axis axis1 = new Steema.TeeChart.Axis(false, false, tChart1.Chart); 
			tChart1.Axes.Custom.Add(axis1); 
			line2.CustomVertAxis = axis1; 
			axis1.StartPosition = 50; 
			axis1.EndPosition = 100; 

			tChart1.Axes.Left.EndPosition = 50;

			for (int i = 0; i < 10; i++)
			{
				line1.Add(i * 100);
				line2.Add(i * 10000);
			}

			Bitmap bmp = tChart1.Bitmap;

			tChart1.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
			tChart1.Panel.MarginLeft = Math.Max(line1.GetVertAxis.MaxLabelsWidth(), line2.GetVertAxis.MaxLabelsWidth());
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

history
Newbie
Newbie
Posts: 29
Joined: Tue May 22, 2007 12:00 am

Post by history » Wed Apr 16, 2008 1:01 pm

Does MaxLabelsWidth take into account the Font size?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Apr 16, 2008 1:33 pm

Hi history,

Yes, internal methods use MeasureString method for this calculation.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply