How to paint selected point on 3D surface?

2019-06-13 17:41发布

问题:

How can I paint selected point on TeeChart 3D Surface?

回答1:

  • If you want to highlight the cell below the mouse, you can use the TSurfaceNearestTool to highlight a TSurfaceSeries cell like in the example at "All Features\Welcome !\Tools\Surface Nearest" in the Features Demo program:

The Features Demo program (Tee9New.exe) is shipped with the installation of the component, and you can alternatively download the "TeeChart compiled demo" here.

You just have to create the tool and assign a surface to it. Ie:

uses TeeSurfaceTool, TeeSurfa;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.AddSeries(TSurfaceSeries).FillSampleValues;

  (Chart1.Tools.Add(TSurfaceNearestTool) as TSurfaceNearestTool).Series:=Chart1[0];
end;
  • If you know the ValueIndex of the cell to highlight, you can just change the ValueColor[ValueIndex] property. Ie:
uses TeeSurfa, TeeTools;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin    
  Chart1.Aspect.Zoom:=80;
  Chart1.Chart3DPercent:=100;

  with Chart1.AddSeries(TSurfaceSeries) as TSurfaceSeries do
  begin
    FillSampleValues;

    UseColorRange:=false;
    UsePalette:=false;
    for i:=0 to Count-1 do
      if (i mod 2 = 0) then
        ValueColor[i]:=clGreen;
  end;
end;