Positioning x axis absolutely

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
betulus
Newbie
Newbie
Posts: 25
Joined: Wed Apr 28, 2004 4:00 am
Location: Britishland

Positioning x axis absolutely

Post by betulus » Wed Apr 27, 2005 10:02 am

Hi there,

I am trying to work out how to position the x / bottom axis at position 0 on the y axis. The documentation says you can position it using a percentage of the way along / up the y axis but this seems completely wrong for my needs.

I am doing quite a simple bar chart with year (datetime) data along the x axis and numerical values up the y axis. At present the axis seems to be located at the minimum end of the y axis.

Thanks
Matt Wilkinson
British Land

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 27, 2005 11:36 am

Hi Matt,

You can implement the following code at the BeforeDrawSeries event to get this behaviour.

Code: Select all

		private void tChart1_BeforeDrawSeries(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			int posaxis;

			if (tChart1.Axes.Left.Maximum > 0)
			{
				posaxis = (tChart1.Axes.Left.CalcYPosValue(0));
				tChart1.Axes.Bottom.Draw (posaxis + 10, posaxis + 40, posaxis, true);				
			}
		}
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

betulus
Newbie
Newbie
Posts: 25
Joined: Wed Apr 28, 2004 4:00 am
Location: Britishland

Post by betulus » Wed Apr 27, 2005 1:04 pm

Thanks Narcis,

This event doesn't seem to fire for some reason. I have added this to the InitializeComponent() method of the code behind:

this.WebChart1.BeforeDraw += new Steema.TeeChart.PaintChartEventHandler(this.WebChart1_BeforeDraw);

Also, when you look at the control properties in design view the event seems to have wired up properly. I am testing it by putting a break point on the first line of the event code.

Is there some weird secret to making this work?

event code:

private void WebChart1_BeforeDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
int posaxis;
if (this.WebChart1.Chart.Axes.Left.Maximum > 0)
{
posaxis = (WebChart1.Chart.Axes.Left.CalcYPosValue(0));
WebChart1.Chart.Axes.Bottom.Draw (posaxis + 10, posaxis + 40, posaxis, true);
}
}

Matt

betulus
Newbie
Newbie
Posts: 25
Joined: Wed Apr 28, 2004 4:00 am
Location: Britishland

Post by betulus » Wed Apr 27, 2005 1:10 pm

Sorry, forget that, it just started working for some reason. I added an afterDraw event handler and that seemed make both events work.

Thanks
Looks much better.

Post Reply