TCrossFunction -- can I get the returnvalue of the crosspoint?
-
- Newbie
- Posts: 15
- Joined: Tue Nov 09, 2021 12:00 am
TCrossFunction -- can I get the returnvalue of the crosspoint?
series 1 and series2 is crossing .. but how do I get the value of the cross point
-
- Newbie
- Posts: 14
- Joined: Mon Feb 27, 2023 12:00 am
Re: TCrossFunction -- can I get the returnvalue of the crosspoint?
Do i understand correctly that the first point in the parent series is the first cross point?
Code: Select all
repeat
if LinesCross(index1,index2,x,y) then
ParentSeries.AddXY(x,y);
Re: TCrossFunction -- can I get the returnvalue of the crosspoint?
Hello,
Yes, the series you assign the
Ie:
Yes, the series you assign the
TCrossPointsFunction
to contains the crossing points.Ie:
Code: Select all
uses Vcl.StdCtrls, VCLTee.TeeGDIPlus, VCLTee.Chart, VCLTee.Series, VCLTee.StatChar;
var Chart1: TChart;
line1, line2: TLineSeries;
crossFunction: TCrossPointsFunction;
crossPoints: TPointSeries;
Memo1: TMemo;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Chart1:=TChart.Create(Self);
Chart1.Parent:=Self;
Chart1.Align:=alClient;
Chart1.View3D:=False;
Chart1.Legend.Hide;
Memo1:=TMemo.Create(Self);
Memo1.Parent:=Self;
Memo1.Align:=alRight;
line1:=TLineSeries(Chart1.AddSeries(TLineSeries));
line2:=TLineSeries(Chart1.AddSeries(TLineSeries));
line1.FillSampleValues;
line2.FillSampleValues;
crossFunction:=TCrossPointsFunction.Create(Self);
crossPoints:=TPointSeries(Chart1.AddSeries(TPointSeries));
crossPoints.Pointer.Size:=2;
crossPoints.FunctionType:=crossFunction;
crossPoints.DataSources.Add(line1);
crossPoints.DataSources.Add(line2);
Memo1.Lines.Add('Crossing Points:');
with crossPoints do
for i:=0 to Count-1 do
Memo1.Lines.Add('X: '+FormatFloat(ValueFormat, XValues[i])+', Y: '+FormatFloat(ValueFormat, YValues[i]));
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 15
- Joined: Tue Nov 09, 2021 12:00 am
Re: TCrossFunction -- can I get the returnvalue of the crosspoint?
thanks ..clear! but..
where exactly is the trigger for the final painting of the chart and lines.
I try to debug step by step in Tee9New.. but get lost.
is it here?
------ from Base Form---------------
ncGDIPlus : if not (Chart1.Canvas is TGLCanvas) then // <-- For demos with default OpenGL Canvas, do not change it !
if not (Chart1.Canvas is TGDIPlusCanvas) then // <-- Do not assign a GDI+ canvas if it already is !
Chart1.Canvas:=TGDIPlusCanvas.Create;
{$ENDIF}
else
Chart1.Canvas:=TTeeCanvas3D.Create;
where exactly is the trigger for the final painting of the chart and lines.
I try to debug step by step in Tee9New.. but get lost.
is it here?
------ from Base Form---------------
ncGDIPlus : if not (Chart1.Canvas is TGLCanvas) then // <-- For demos with default OpenGL Canvas, do not change it !
if not (Chart1.Canvas is TGDIPlusCanvas) then // <-- Do not assign a GDI+ canvas if it already is !
Chart1.Canvas:=TGDIPlusCanvas.Create;
{$ENDIF}
else
Chart1.Canvas:=TTeeCanvas3D.Create;
Re: TCrossFunction -- can I get the returnvalue of the crosspoint?
Hello,
I'm not sure what are you trying to achieve.
In the example I posted above, the calculation of the crossing points starts as soon as the second series is added to the crossPoints DataSources.
I'm not sure what are you trying to achieve.
In the example I posted above, the calculation of the crossing points starts as soon as the second series is added to the crossPoints DataSources.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |