Page 1 of 1

My problem with the functions...

Posted: Tue Jul 06, 2004 2:42 pm
by 8439980
Sorry,

i know i posted the problem once before. But this time i will try it with code:
One TeeChart, 2 Buttons, 1TeeCommander is on the Form

1) Press the button that generates the series. Pres the one that deletes the series. Repeat these two steps several times.
2) Press the button again that generates the series
3) Press the edit icon on the TeeCommander
4) Swith to 'Series/DataSource', switch the combo box to 'function'
5) and now have a closer look at the Listbox named 'Available' (i have as many several empty entries as step 1 was repeated)

6) is there any hope to change this?


I don't thin think that this is wanted. Can several problems be related with this,when i try to access a function for one series from another.

Jan

PS: i found under TeeCommander/Export/Format several possibilities as export-formats in your 'WhatsNew'-demo. I have just got Bitmap and Metafile (registered TeeChart 6 Delphi), can i enhence this by code?
-----------------------------
Source:

Procedure TForm1.GenerateSurfaceAndContour (Source3D:TCustom3DSeries; FulcrumX, FulcrumZ:Integer);

Function ClosestValue(Source3D:TCustom3DSeries; const X,Z:TChartValue):TChartValue;
var Closer,
t : Integer;
tmpX,
tmpZ,
dist,
MaxDist : Double;
begin
MaxDist := Infinity;
Closer := -1;
result := 0;

with Source3D do
for t:=0 to Count-1 do
begin
tmpX:=XValues.Value[t]-X;
tmpZ:=ZValues.Value[t]-Z;
dist:=Sqrt(Sqr(tmpX)+Sqr(tmpZ));
if dist<MaxDist then
begin
MaxDist:=dist;
Closer:=t;
end;
end;

if Closer<>-1 then
result:=Source3D.YValues.Value[Closer];
end;


Var SeriesNo : Integer;
PosX : Double;
PosZ : Double;
StepX : Double;
StepZ : Double;
StopX : Double;
StopZ : Double;
BeginZ : Double;
YHeight : Double;
Begin
SeriesNo := Chart1.SeriesCount;
Chart1.AddSeries(TSurfaceSeries);
With (Chart1.Series[SeriesNo] as TSurfaceSeries) do
Begin
Clear;
IrregularGrid := True;
VertAxis := aLeftAxis;
HorizAxis:= aBottomAxis;
ZOrder := 0;

PosX := Source3D.XValues.MinValue;
PosZ := Source3D.ZValues.MinValue;


BeginZ:= PosZ;

StepX := Source3D.XValues.Range / (FulcrumX);
StepZ := Source3D.ZValues.Range / (FulcrumZ);

StopX := Source3D.XValues.MaxValue + StepX;
StopZ := Source3D.ZValues.MaxValue + StepZ;

Repeat
PosZ := BeginZ;
Repeat
YHeight := ClosestValue (Source3D, PosX, PosZ);
AddXYZ (PosX, YHeight, PosZ);
PosZ := PosZ + StepZ
Until PosZ > StopZ;

PosX := PosX + StepX;
Until PosX > StopX;
end;



SeriesNo := Chart1.SeriesCount;
Chart1.AddSeries(TContourSeries);
With (Chart1.Series[SeriesNo] as TContourSeries) do
Begin
VertAxis := aLeftAxis;
HorizAxis:= aBottomAxis;
IrregularGrid := True;
DataSource := Chart1.Series[1];
NumLevels := 20;
YPositionLevel := True;
ZOrder := 0;
Depth := 10;
end;

end;


procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Chart1.RemoveAllSeries;
end;



procedure TForm1.BitBtn2Click(Sender: TObject);
Var SeriesCounter : Integer;
x, z : Integer;
begin


SeriesCounter := Chart1.SeriesCount;
CHart1.AddSeries (TPoint3dSeries);
With (Chart1.Series[SeriesCounter] as TPoint3dSeries) do
Begin
Clear;
VertAxis := aLeftAxis;
HorizAxis := aBottomAxis;
Zorder := 0;

For x := -20 to 20 do
For z := -20 to 20 do
AddXYZ (x/10*20, Sin((x*z)*pi/180) , z/10*20);
end;

GenerateSurfaceAndContour ((Chart1.Series[SeriesCounter] as TPoint3DSeries), 30, 30);

end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Chart1.FreeAllSeries();
Chart1.RemoveAllSeries;
end;

Posted: Tue Jul 13, 2004 12:37 pm
by 8439980
Sorry, but is anybody able to help me with this problem? It is quiet urgent, i would like to use these features within the next release of the program....This is planned to be within the next two weeks...

Thanks, Jan