TCustom3DSeries.CalcZPos
TCustom3DSeries
function CalcZPos(ValueIndex: Integer): Integer;
Unit
TeeSurfa
Description
Returns the pixel integer value of the Z position of the ValueIndex'th point.
It uses the Chart's Width3D and Height3D displacement to set the offset of the return value.
This works correctly with all TeeChart 3D modes, orthogonal, native 3D and OpenGL.
Example:
{ Instructions:
1) Add a Surface series to an empty Chart.
2) Add a ScrollBar control to the form.
3) Use the ScrollBar OnChange and the Chart OnAfterDraw events
and paste the code below:
At run-time, move the scrollbar.
}
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(10);
end;
procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
Chart1.Repaint;
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
var tmp:Integer;
begin
tmp:=Series1.CalcZPos( ScrollBar1.Position );
Chart1.Canvas.MoveTo3D( Chart1.BottomAxis.IEndPos, Chart1.ChartRect.Bottom, tmp);
Chart1.Canvas.LineTo3D( Chart1.BottomAxis.IEndPos, Chart1.ChartRect.Top, tmp);
end;