Page 1 of 1

polar surface graph

Posted: Thu Jun 09, 2011 10:54 am
by 16559493
How can you make a 3d polar surface graph (angle, radius, value) ?

Re: polar surface graph

Posted: Fri Jun 10, 2011 8:06 am
by yeray
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

Re: polar surface graph

Posted: Fri Jun 10, 2011 12:16 pm
by yeray
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 4852 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 4837 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.