Page 1 of 1

Marks intersect with 3d Pie sidewall

Posted: Tue Nov 21, 2006 2:55 am
by 9336216
To get an angled 3D pie with a side wall I set the TChart::View3DOptions->Elevation property and the TChart::Chart3DPercent property. This works exactly as expected and the pie draws itself tilted with a sidewall below the pie.

However if I display the Marks, then they overlap with the 3D side wall of the pie.

Setting Marks->Clip=true makes no difference

Posted: Tue Nov 21, 2006 9:38 am
by narcis
Hi MikeI,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.

Posted: Wed Nov 22, 2006 8:54 am
by narcis
Hi MikeI,

Thanks for the example, now I could see the problem you were reporting and this is TeeChart's normal behaviour. Where would you expect those marks ('502 and '732') to be drawn?

Thanks in advance.

Posted: Fri Nov 24, 2006 12:18 pm
by narcis
Hi MikeI,

Ok, then you can do something like this:

Code: Select all

void __fastcall TForm1::FormCreate(TObject *Sender)
{
	Boolean MarkInPie;

	Chart1->Draw();

	for (int i=0; i < Series1->Count()-1; i++)
	{
		MarkInPie = false;

		int x0 = Series1->Marks->Positions->Position[i]->LeftTop.x;
		int y0 = Series1->Marks->Positions->Position[i]->LeftTop.y-150;
		int x1 = x0 + Series1->Marks->Positions->Position[i]->Width;
		int y1 = y0 + Series1->Marks->Positions->Position[i]->Height;

		if (Series1->Clicked(x0,y0) != -1) MarkInPie = true;
		if (Series1->Clicked(x0,y1) != -1) MarkInPie = true;
		if (Series1->Clicked(x1,y0) != -1) MarkInPie = true;
		if (Series1->Clicked(x1,y1) != -1) MarkInPie = true;

		if (MarkInPie)
		{
			Series1->Marks->Positions->Position[i]->Custom=true;
			Series1->Marks->Positions->Position[i]->LeftTop.y += 75;
		}
	}

	Chart1->Draw();
}

Marks intersect with 3D sidewall

Posted: Sun Dec 10, 2006 9:54 pm
by 9336216
Thanks Narcis

I have done as you suggest and then calculate the distance to move the mark according to the maximum height of the wall. But, there are cases where the wall gets smaller near the edges of the ellipse/sidewall. How can I calculate this area. I can send an example jpg if needed to illustrate the issue.

I get the maximum wall height as follows:

int ITPieSeries::GetMaxWallHeight ()
{
int iWallHeight = 0;
if (ParentChart && ParentChart->View3D)
{
int iMaxHeight = ParentChart->Height3D;
double iDegrees = 90 - (ParentChart->View3DOptions->Elevation - 270);
double dRadians = PiDegree * iDegrees;
double dSine = sin (dRadians);
iWallHeight = Round (iMaxHeight * dSine);
}
return iWallHeight;
}

Posted: Mon Dec 11, 2006 2:05 pm
by narcis
Hi MikeI,

I understand what you mean but it is not an easy thing to achieve. To calculate this area you may need some trigonometry based on pie's center and radius and on the chart's elevation. The easiest way would be considering it a regular wall.