ColorLine with fill?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
JayG
Newbie
Newbie
Posts: 71
Joined: Mon Sep 04, 2006 12:00 am

ColorLine with fill?

Post by JayG » Tue Apr 10, 2007 5:41 pm

Hi,

I would like my 3d chart to have a tool like the ColorLine, but with the resulting rectangle filled in and partially transparent. Is there a way to do that with a ColorLine, or will I need to draw a shape myself?

If I need to draw it myself, what method can I use to draw a rectangle oriented like a ColorLine tool based on the left axis, with all 4 corners having the same X value?

Jay

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 11, 2007 11:18 am

Hi Jay,

I'm afraid ColorLine doesn't support this. However you can achieve what you request custom drawing on TeeChart's canvas in its AfterDraw event and using something like this:

Code: Select all

		private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			int rectPos = tChart1.Axes.Left.CalcYPosValue(points1.MinYValue() + ((points1.MinYValue() + points1.MaxYValue()) / 2));

			g.Pen.Color = Color.Red;
			g.Brush.Color = Color.Red;
			g.Brush.Transparency = 50;
			g.RectangleY(tChart1.Axes.Bottom.IStartPos, rectPos, tChart1.Axes.Bottom.IEndPos, 0, tChart1.Axes.Depth.IEndPos);
		}
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

JayG
Newbie
Newbie
Posts: 71
Joined: Mon Sep 04, 2006 12:00 am

ColorLine with fill?

Post by JayG » Thu Apr 12, 2007 7:41 pm

Narcís,

Thanks for the suggestion. I need a vertical rectangle instead of a horizontal one, but I don't see a RectangleX method. None of the other Rectangle methods seem to do what I want. Is there another method I could use?

Jay

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

Post by Narcís » Fri Apr 13, 2007 7:48 am

Hi Jay,

Yes, in that case you can use RectangleZ:

Code: Select all

		private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			int hRectPos = tChart1.Axes.Left.CalcYPosValue(points1.MinYValue() + ((points1.MinYValue() + points1.MaxYValue()) / 2));
			int vRectPos = tChart1.Axes.Bottom.CalcXPosValue(points1.MinXValue() + ((points1.MinXValue() + points1.MaxXValue()) / 2));

			g.Pen.Color = Color.Red;
			g.Brush.Color = Color.Red;
			g.Brush.Transparency = 50;
			g.RectangleY(tChart1.Axes.Bottom.IStartPos, hRectPos, tChart1.Axes.Bottom.IEndPos, 0, tChart1.Axes.Depth.IEndPos);
			g.RectangleZ(vRectPos, tChart1.Axes.Left.IStartPos, tChart1.Axes.Left.IEndPos, 0, tChart1.Axes.Depth.IEndPos);			
		}
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

JayG
Newbie
Newbie
Posts: 71
Joined: Mon Sep 04, 2006 12:00 am

ColorLine with fill?

Post by JayG » Fri Apr 13, 2007 3:10 pm

Thanks!

Now if there was a way get the chart series lines to pass "through" the rectangle instead of being drawn "in front of" it or "behind" it, that would be REALLY cool! Very hard to do though, I imagine...

Jay

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

Post by Narcís » Mon Apr 16, 2007 2:59 pm

Hi Jay,

Yes, this is possible doing the custom drawing in the BeforeDrawSeries event. Something like this:

Code: Select all

		private void DrawRectangles(Steema.TeeChart.Drawing.Graphics3D g)
		{
			int hRectPos = tChart1.Axes.Left.CalcYPosValue(points1.MinYValue() + ((points1.MinYValue() + points1.MaxYValue()) / 2));
			int vRectPos = tChart1.Axes.Bottom.CalcXPosValue(points1.MinXValue() + ((points1.MinXValue() + points1.MaxXValue()) / 2));

			g.Pen.Color = Color.Red;
			g.Brush.Visible = true;
			g.Brush.Color = Color.Red;
			g.Brush.Transparency = 50;
			g.RectangleY(tChart1.Axes.Bottom.IStartPos, hRectPos, tChart1.Axes.Bottom.IEndPos, 0, tChart1.Axes.Depth.IEndPos);
			g.RectangleZ(vRectPos, tChart1.Axes.Left.IStartPos, tChart1.Axes.Left.IEndPos, 0, tChart1.Axes.Depth.IEndPos);

		}

		private void tChart1_BeforeDrawSeries(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			DrawRectangles(g);
		}
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