Help with Margin on Axis Bottom

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
jjs2002
Newbie
Newbie
Posts: 4
Joined: Tue Jul 08, 2003 4:00 am

Help with Margin on Axis Bottom

Post by jjs2002 » Mon Dec 10, 2007 11:09 pm

I am using TeeChart for .NET Version 2, and am building a financial graph with multiple right axes and a bottom axis. I would like a margin on each side of the bottom axis. I seem to almost be able to accomplish this by setting Axes.Bottom.StartPosition and Axes.Bottom.EndPosition to 2 and 98 respectively, but the problem is that the series are still drawing in the margins that it creates. I am not using Automatic on the Axes, I am setting them with SetMinMax, Automatic will not work for what I am doing.

I would like for the series not to be visible in the gap that I create. Is there a way to do this?

Thanks for any help.

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

Post by Narcís » Tue Dec 11, 2007 9:09 am

Hi jjs2002,

Are your series assigned to this bottom axis? The code below works fine for me here using latest TeeChart for .NET v2 release available at the client area. Which version are you using exactly?

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			tChart1.Aspect.View3D = false;
			tChart1.Series.Clear();

			Steema.TeeChart.Styles.Candle candle1 = new Steema.TeeChart.Styles.Candle(tChart1.Chart);
			
			candle1.FillSampleValues();
			candle1.HorizAxis = Steema.TeeChart.Styles.HorizontalAxis.Bottom;

			tChart1.Axes.Bottom.StartPosition = 2;
			tChart1.Axes.Bottom.EndPosition = 98;
		}
If the problem persists, could you please send us a simple example project we can run "as-is" to reproduce the problem here?

You can either post your files at news://www.steema.net/steema.public.atatchments newsgroup or at our upload page.

Thanks in advance.
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

jjs2002
Newbie
Newbie
Posts: 4
Joined: Tue Jul 08, 2003 4:00 am

Post by jjs2002 » Tue Dec 11, 2007 9:41 pm

I used the code that you pasted in the comment above, and had the same problem. It works great when the graph first loads up, but if you zoom in and drag around you will see that the series draws inside of the margin created between the bottom axis and the vertical axis. I would like for this margin to be empty even when zooming or dragging.

I am using TChart for .NET version 2.0.2586.24039. Thanks for any more help!

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 Dec 12, 2007 10:41 am

Hi jjs2002,

In that case you can use the ClipRectangle method in the BeforeDrawValues event:

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			tChart1.Aspect.View3D = false;
			tChart1.Series.Clear();

			Steema.TeeChart.Styles.Candle candle1 = new Steema.TeeChart.Styles.Candle(tChart1.Chart);
			
			candle1.FillSampleValues();
			candle1.HorizAxis = Steema.TeeChart.Styles.HorizontalAxis.Bottom;

			tChart1.Axes.Bottom.StartPosition = 2;
			tChart1.Axes.Bottom.EndPosition = 98;

			candle1.BeforeDrawValues += new Steema.TeeChart.PaintChartEventHandler(candle1_BeforeDrawValues);
		}

		void candle1_BeforeDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			Steema.TeeChart.Styles.Series s = sender as Steema.TeeChart.Styles.Series;

			int left = s.GetHorizAxis.IStartPos;
			int right = s.GetHorizAxis.IEndPos;
			int top = s.GetVertAxis.IStartPos;
			int bottom = s.GetVertAxis.IEndPos;
			g.ClipRectangle(left, top, right, bottom); 
		}
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