Page 1 of 1

ColorLine with fill?

Posted: Tue Apr 10, 2007 5:41 pm
by 9792387
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

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

ColorLine with fill?

Posted: Thu Apr 12, 2007 7:41 pm
by 9792387
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

Posted: Fri Apr 13, 2007 7:48 am
by narcis
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);			
		}

ColorLine with fill?

Posted: Fri Apr 13, 2007 3:10 pm
by 9792387
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

Posted: Mon Apr 16, 2007 2:59 pm
by narcis
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);
		}