Page 1 of 1

Force pie-graph to be "circle"

Posted: Wed Aug 16, 2006 3:56 pm
by 9241982
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.

Posted: Thu Aug 17, 2006 4:44 am
by 9241982
Hoia!

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

pieChartSeries.Circled := true;

And voila!

How to make TPieSeries circular in widescreen

Posted: Thu Nov 16, 2006 9:55 pm
by 9336216
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 ();
}