Page 1 of 1

How to color an axis?

Posted: Mon Oct 08, 2007 7:25 pm
by 9641771
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?

Posted: Tue Oct 09, 2007 7:48 am
by narcis
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);
		}