Page 1 of 1

Positioning x axis absolutely

Posted: Wed Apr 27, 2005 10:02 am
by 8125254
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

Posted: Wed Apr 27, 2005 11:36 am
by narcis
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);				
			}
		}

Posted: Wed Apr 27, 2005 1:04 pm
by 8125254
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

Posted: Wed Apr 27, 2005 1:10 pm
by 8125254
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.