TPolarSeries, to draw a semi-circle chart and set the min

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
sripe
Newbie
Newbie
Posts: 26
Joined: Thu Sep 10, 2015 12:00 am

TPolarSeries, to draw a semi-circle chart and set the min

Post by sripe » Wed Jan 27, 2016 9:29 am

Hello,
For TPolarSeries, there are some useful properties, such as AngleIncrement, RadiusIncrement, to improve the chart appearance. Can I set the minimum / maximum of Angle, Radius? Can I draw a semi-circle or quarter-circle chart if my series angles are always limited in 180 or 90 degrees?
Best regards,
Xiushan

Yeray
Site Admin
Site Admin
Posts: 9534
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TPolarSeries, to draw a semi-circle chart and set the min

Post by Yeray » Wed Jan 27, 2016 3:45 pm

Hello Xiushan,

I'm afraid it's not possible right now so I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1418

However, you could still hide most part of the TPolarSeries and draw your semicircle manually. Ie, you can start with something like this:

Code: Select all

const PolarAngle=180;

procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
var polar: TPolarSeries;
begin
  if (Chart1.SeriesCount>0) and (Chart1[0] is TPolarSeries) then
  begin
    polar:=Chart1[0] as TPolarSeries;

    with Chart1.Canvas do
    begin
      Pen.Color:=clLtGray;
      Brush.Clear;
      Pie(polar.CircleRect, 0, PolarAngle);
    end;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var i, n: Integer;
begin
  Chart1.View3D:=false;

  n:=5;
  with Chart1.AddSeries(TPolarSeries) as TPolarSeries do
  begin
    for i:=0 to n-1 do
      AddPolar(i*PolarAngle/n, random*100);

    CircleBrush.Clear;
    CirclePen.Visible:=false;

    OnGetCircleLabel:=PolarGetCircleLabel;
    GetVertAxis.Grid.Visible:=false;
    GetHorizAxis.Grid.Visible:=false;
    GetHorizAxis.Ticks.Visible:=false;
    GetHorizAxis.MinorTicks.Visible:=false;
    Chart1.Axes.Left.Visible:=false;
  end;

  Chart1.Draw;
end;

procedure TForm1.PolarGetCircleLabel(Sender:TCustomPolarSeries; const Angle:Double;
                             Index:Integer; var Text:String);
begin
  if Angle>PolarAngle then
    Text:='';
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply