Page 1 of 1

How to draw TTowerSeries side-by-side?

Posted: Sun Apr 02, 2006 7:47 pm
by 9236851
BCB6 + TC7.05

TTowerSeries has no Multibar property.
Is there a way to draw two TTowerSeries in the same Chart side-by-side?

Thanks in advance,

Wiebe

Posted: Mon Apr 03, 2006 9:21 am
by narcis
Hi Wiebe,

You can try doing something like this:

Code: Select all

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

	Series1->PercentDepth=50;
	Series1->PercentWidth=50;
	Series2->PercentDepth=50;
	Series2->PercentWidth=50;

	for (int i=0; i <= 10; i++)
		for (int j=0; j <= 10; j++)
		{
			Series1->AddXYZ(i-0.5,i+j,j-0.5);
			Series2->AddXYZ(i+0.5,i*j,j+0.5);
		}
}

Posted: Mon Apr 03, 2006 8:31 pm
by 9236851
Thanks NarcĂ­s,

This does not produce a side-by-side profile.

Following code (in Form constructor) comes closer:

double width=25.0;
Series1->PercentDepth=25;
Series1->PercentWidth=(int)width;
Series2->PercentDepth=25;
Series2->PercentWidth=(int)width;

for (int i=0; i <= 10; i++)
for (int j=0; j <= 10; j++)
{
Series1->AddXYZ((double)i-.005*width,i+j,j);
Series2->AddXYZ((double)i+.005*width,i+j,j);
}

However during rotation, since the "semi"adjacent bars are in fact treated as different objects, mutual coverage spoils the scenary.
There may be a better approach...

Wiebe

Posted: Wed Apr 05, 2006 2:51 pm
by 9236851
Following code provides a better basis:

double width=25.0;
AnsiString s;
Series1->PercentDepth=25;
Series1->PercentWidth=(int)width;
Series2->PercentDepth=25;
Series2->PercentWidth=(int)width;

for (int i=0; i <= 10; i++)
{
for (int j=0; j <= 10; j++)
{
s = i;
Series1->AddXYZ((double)i-.005*width, i+j+2, j, s, clRed );
Series1->AddXYZ((double)i+.005*width, i+(j+2)/2, j, "", clGreen );
}
}