Force pie-graph to be "circle"

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
mertero
Newbie
Newbie
Posts: 4
Joined: Mon Jul 24, 2006 12:00 am

Force pie-graph to be "circle"

Post by mertero » Wed Aug 16, 2006 3:56 pm

Hello guys.

I have a pie-chart, and the size of the component varies with the form's size (i.e. the user can change his window's size).

The problem is that sometimes the pie can become an elliptic and not a circle - if the width is larger than the height, etc. (well, it actually includes a legend, so it is a circle when the width is larger).

Is there a way I can force the graph to be a real circle, even if I'll have some "Dead" screen not used?

I'm using V7, Pro, with delphi 2005.

Thanks,

Ron.

mertero
Newbie
Newbie
Posts: 4
Joined: Mon Jul 24, 2006 12:00 am

Post by mertero » Thu Aug 17, 2006 4:44 am

Hoia!

I found out my answer... There's a 'circled' property:

pieChartSeries.Circled := true;

And voila!

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

How to make TPieSeries circular in widescreen

Post by MikeI » Thu Nov 16, 2006 9:55 pm

The TPieSeries::Circled proerty does not work as expected in widescreen modes as it produces non circular pies. Here is a work around which makes a pie XRadius and YRadius the same. Its in C++

1) Dervive a class from TPieSeries

2) Overide its DoBeforeDrawValues procedure as follows:

// Bug Fix E:
void __fastcall ITPieSeries::DoBeforeDrawValues ()
{
TPieSeries::DoBeforeDrawValues ();

if (Circled)
{
MakeCircled ();
}
}

void ITPieSeries::MakeCircled ()
{
int iDiff = abs (YRadius - XRadius);
if (YRadius < XRadius)
{
CircleRect.Left += iDiff;
CircleRect.Right -= iDiff;
}
else if (YRadius > XRadius)
{
CircleRect.Top += iDiff;
CircleRect.Bottom -= iDiff;
}

AdjustCircleRect ();
CalcRadius ();
}

Post Reply