⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 surface_contour.pas

📁 Delphi Component - Chart Fx
💻 PAS
字号:
unit surface_contour;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  OleCtrls, ChartfxLib_TLB, SfxBar_TLB, StdCtrls;

type
  TForm1 = class(TForm)
    ChartFX1: TChartFX;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
VAR
    i,j:Integer;
    s:String;
begin

    // Initialize data
    With ChartFX1 do begin
        Axis[AXIS_Y].ResetScale;
        Axis[AXIS_Y].Decimals := 0;

        // Set smooth data
        OpenDataEx(COD_VALUES, 20, 20);
        For i := 0 To 19 Do Begin
            If i Mod 2 = 0 Then begin
               Str(i,s);
               ChartFX1.KeySer[i] := s; // X-Axis labels
            end;

            For j := 0 To 19 do
                ChartFX1.ValueEx[i, j] := (Sin((i * 2 * 3.1416) / 19) * Cos(((j + 5) * 2 * 3.1416) / 19)) * 100;
        End;
        CloseData(COD_VALUES);


        // 3D Settings
        View3DDepth := 60;
        AngleX := 30;
        AngleY := 45;

        // Constrains
        ShowTips := False;
        AllowDrag := False;

        SerLegBoxObj.BorderStyle := BBS_NONE;
    End;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
    // Surface plot
    With ChartFX1 Do Begin
        LeftGap := 30;
        RightGap := 10;
        TopGap := 10;
        BottomGap := 20;

        Gallery := SURFACE;
        SetContourLabels(20); // 20 is my "layer size"
        SerLegBoxObj.Docked := TGFP_BOTTOM;

        Axis[AXIS_Y].Style := Axis[AXIS_Y].Style Or AS_BREAKZERO
    End
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
    // Contour plot
    With ChartFX1 do begin
        LeftGap := 0;
        RightGap := 20;
        TopGap := 0;
        BottomGap := 20;
        
        Gallery := CONTOUR;
        SetContourLabels(20); // 20 is my "layer size"
        SerLegBoxObj.Docked := TGFP_RIGHT;
        
        Axis[AXIS_Y].Style := Axis[AXIS_Y].Style And Not AS_BREAKZERO;
    End;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -