Is it possible to create a SurfaceSeries from multiple LineSeries?
If I have LineSeries1 and LineSeries2 both with same X values, can I create a SurfaceSeries that has these values with Z=1 and Z=2; that is,
Given
LineSeries1 constructed by:
LineSeries1.AddXY(X1,Y1)
LineSeries2 constructed by:
LineSeries2.AddXY(X1,Y2)
Is thers a function so that SurfaceSeries = LineSeries1 (z=1) x LineSeries2 (z=2)
I would like to be able to switch from a family of curves to a surface plot quickly without having to reformat the data.
Surface Series from multiple line series?
Hi.
You can also copy the values directly from series XValues and Yvalues list(s).
Yes, providing all series have the same number of points and (more importantly), all series have the same x values. If this condition is satisfied, you can use TSurfaceSeries.AddXYZ method to add points from individual series. ExampleIs it possible to create a SurfaceSeries from multiple LineSeries?
Code: Select all
surface1.Clear;
for i:= Low(X1) to High(X1) do surface1.AddXYZ(X1[i],Y1[i],1.0);
for i:= Low(X1) to High(X1) do surface1.AddXYZ(X1[i],Y2[i],1.0);
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi NREL,
As an example, you can place a Chart with a Surface Series on a form, a button and do something like:
As an example, you can place a Chart with a Surface Series on a form, a button and do something like:
Code: Select all
private
{ Private declarations }
XValues: array[0..19] of double;
YValues: array[0..19] of double;
ZValues: array[0..19] of double;
flag: boolean;
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
count,i: integer;
X,Y,Z: integer;
begin
count:=0;
flag:=false;
Randomize;
for X := 0 to 9 do
for Z := 0 to 1 do
begin
Y := Random(100);
XValues[count] := X;
ZValues[count] := Z;
YValues[count] := Y;
inc(count);
end;
for i:=0 to 19 do
series1.AddXYZ(XValues[i], YValues[i], ZValues[i]);
Chart1.Axes.Depth.Visible := true;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
count,i,j: integer;
X,Z: integer;
Surface: TSurfaceSeries;
begin
count:=0;
Chart1.RemoveAllSeries;
flag := not flag;
if (flag) then
begin
for i:=0 to 1 do
Chart1.AddSeries(TLineSeries);
for X:=0 to 9 do
for Z:=0 to 1 do
begin
Chart1[1-Z].AddXY(X, YValues[count]);
inc(count);
end;
end
else
begin
Surface:=TSurfaceSeries.Create(self);
Chart1.AddSeries(Surface);
for j:=0 to 19 do
Surface.AddXYZ(XValues[j], YValues[j], ZValues[j]);
end;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi, Steve.
Yes, sure. Use the following code:
Or alternatively, simply switch from line to fastline series.
Yes, sure. Use the following code:
Code: Select all
Series1.Depth := 0;
Series1.LinePen.Color := clRed;
Series2.Depth := 0;
Series2.LinePen.Color := clGreen;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com