Marks intersect with 3d Pie sidewall

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
MikeI
Newbie
Newbie
Posts: 8
Joined: Tue Mar 09, 2004 5:00 am

Marks intersect with 3d Pie sidewall

Post by MikeI » Tue Nov 21, 2006 2:55 am

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

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 Nov 21, 2006 9:38 am

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.
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

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 Nov 22, 2006 8:54 am

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.
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

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 Nov 24, 2006 12:18 pm

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();
}
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

MikeI
Newbie
Newbie
Posts: 8
Joined: Tue Mar 09, 2004 5:00 am

Marks intersect with 3D sidewall

Post by MikeI » Sun Dec 10, 2006 9:54 pm

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;
}

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 Dec 11, 2006 2:05 pm

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.
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