How to color an axis?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
bairog
Newbie
Newbie
Posts: 72
Joined: Fri Jul 07, 2006 12:00 am
Location: Moscow, Russia
Contact:

How to color an axis?

Post by bairog » Mon Oct 08, 2007 7:25 pm

In my project I need to colour 3 parts of the bottom axis into 3 different colors. How can I do this in teechart v2?
Thank you.

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 Oct 09, 2007 7:48 am

Hi bairog,

I can think of 2 options here:

1. Use custom axes as told in Tutorial 4 - Axis Control and at the features demo (All Features\Welcome!\Axis). You'll find tutorials and demo at TeeChart's program group.

2. Overlap existing bottom axis with custom drawing, for example:

Code: Select all

		private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			int YPos =tChart1.Axes.Bottom.Position;
			
			g.Pen.Width = 2;
			
			g.Pen.Color = Color.Green;			
			g.Line(tChart1.Axes.Bottom.IStartPos, YPos,
							tChart1.Axes.Bottom.CalcXPosValue(5), YPos);
			
			g.Pen.Color = Color.Yellow;
			g.Line(tChart1.Axes.Bottom.CalcXPosValue(5), YPos,
							tChart1.Axes.Bottom.CalcXPosValue(10), YPos);

			g.Pen.Color = Color.Red;
			g.Line(tChart1.Axes.Bottom.CalcXPosValue(10), YPos,
							tChart1.Axes.Bottom.IEndPos, YPos);
		}
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