polar surface graph

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Blue
Newbie
Newbie
Posts: 10
Joined: Wed Jun 08, 2011 12:00 am

polar surface graph

Post by Blue » Thu Jun 09, 2011 10:54 am

How can you make a 3d polar surface graph (angle, radius, value) ?

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

Re: polar surface graph

Post by Yeray » Fri Jun 10, 2011 8:06 am

Hello Blue,

There are the Polar series and the Surface series. I'm not sure to understand what exactly is a 3D Polar Surface. Could you please show us a picture of it?
Thanks in advance
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

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

Re: polar surface graph

Post by Yeray » Fri Jun 10, 2011 12:16 pm

Hello Blue,

I've received your picture showing how the polar surface looks like. Thank you.
I post it here for other customers benefit (if you want me to remove it, don't doubt to ask for it)
polar_surf.png
polar_surf.png (78.31 KiB) Viewed 4810 times
There isn't a series specially thought to do something like that. However it can be done with a TPolarSeries and some customization:

Code: Select all

uses TeePolar, TeCanvas, TeeGDIPlus, TeePNG;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.Canvas:=TGDIPlusCanvas.Create;

  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  with Chart1.AddSeries(TPolarSeries) as TPolarSeries do
  begin
    Circled:=true;
    Pointer.Visible:=false;
    Pen.Visible:=false;
    Transparency:=50;
    AddPolar(10,20);
    AddPolar(50,40);
    AddPolar(40,85);
    AddPolar(10,80);
    AddPolar(-20,70);
    AddPolar(-40,55);
    AddPolar(-30,30);
  end;

  with Chart1.AddSeries(TPolarSeries) as TPolarSeries do
  begin
    Circled:=true;
    Pointer.Visible:=false;
    Pen.Visible:=false;
    Transparency:=50;
    AddPolar(0,30);
    AddPolar(20,40);
    AddPolar(30,70);
    AddPolar(20,70);
    AddPolar(-10,60);
    AddPolar(-30,50);
  end;

  Chart1.Axes.Left.SetMinMax(0,100);
  Chart1.Axes.Bottom.SetMinMax(0,100);
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var i, j: Integer;
    points: array of TPoint;
    blend : TTeeBlend;
begin
  for i:=0 to Chart1.SeriesCount-1 do
  begin
    SetLength(points, Chart1[i].Count);
    for j:=0 to Chart1[i].Count-1 do
    begin
      points[j].X:=Chart1[i].CalcXPos(j);
      points[j].Y:=Chart1[i].CalcYPos(j);
    end;

    Chart1.Canvas.Brush.Color:=Chart1[i].Color;
    Chart1.Canvas.Pen.Style:=psClear;

    blend:=Chart1.Canvas.BeginBlending(Chart1.ChartRect, (Chart1[i] as TPolarSeries).Transparency);
    Chart1.Canvas.Polygon(points);
    Chart1.Canvas.EndBlending(blend);
  end;
end;
tee_polar_surf.png
tee_polar_surf.png (63.12 KiB) Viewed 4795 times
With it, you "only" need to know the Angles and Values for all the points to draw each surface. Of course, each different surface has to be a different TPolarSeries, even if they represent the same "surface" level.
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