polar surface graph
Posted: Thu Jun 09, 2011 10:54 am
How can you make a 3d polar surface graph (angle, radius, value) ?
Steema Software - Customer Support Forums
http://216.92.101.67/support/
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;