界面代码:

object Form1: TForm1
  Left = 202
  Top = 182
  Width = 1305
  Height = 675
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Panel1: TPanel
    Left = 0
    Top = 597
    Width = 1297
    Height = 41
    Align = alBottom
    BevelInner = bvLowered
    TabOrder = 0
    object Button1: TButton
      Left = 16
      Top = 8
      Width = 75
      Height = 25
      Caption = '首页'
      TabOrder = 0
      OnClick = Button1Click
    end
    object Button2: TButton
      Left = 104
      Top = 8
      Width = 75
      Height = 25
      Caption = '末页'
      TabOrder = 1
      OnClick = Button2Click
    end
    object CheckBox1: TCheckBox
      Left = 200
      Top = 12
      Width = 57
      Height = 17
      Caption = '标签'
      Checked = True
      State = cbChecked
      TabOrder = 2
      OnClick = CheckBox1Click
    end
    object CheckBox2: TCheckBox
      Left = 271
      Top = 12
      Width = 66
      Height = 17
      Caption = '点标记'
      Checked = True
      State = cbChecked
      TabOrder = 3
      OnClick = CheckBox2Click
    end
    object CheckBox3: TCheckBox
      Left = 341
      Top = 12
      Width = 52
      Height = 17
      Caption = '3D'
      Checked = True
      State = cbChecked
      TabOrder = 4
      OnClick = CheckBox3Click
    end
  end
  object ChartPageNavigator1: TChartPageNavigator
    Left = 0
    Top = 0
    Width = 1297
    Height = 33
    Align = alTop
    TabOrder = 1
    Chart = Chart1
  end
  object ChartScrollBar1: TChartScrollBar
    Left = 0
    Top = 574
    Width = 1297
    Height = 23
    Align = alBottom
    Enabled = True
    LargeChange = 1
    Max = 1
    Min = 1
    PageSize = 1
    Position = 1
    SmallChange = 1
    TabOrder = 2
    Chart = Chart1
  end
  object Chart1: TChart
    Left = 0
    Top = 33
    Width = 1297
    Height = 541
    Gradient.EndColor = 13556735
    Gradient.StartColor = 16774122
    Gradient.Visible = True
    Title.Text.Strings = (
      '图表滚动和页面导航组件演示')
    MaxPointsPerPage = 20
    Align = alClient
    BevelInner = bvLowered
    TabOrder = 3
    object Series1: TLineSeries
      Marks.Callout.Brush.Color = clBlack
      Marks.Visible = True
      Pointer.InflateMargins = True
      Pointer.Style = psRectangle
      Pointer.Visible = True
      XValues.Name = 'X'
      XValues.Order = loAscending
      YValues.Name = 'Y'
      YValues.Order = loNone
      Data = {
        00190000000000000000406D400000000000C060400000000000806640000000
        00000051400000000000C0554000000000000068400000000000805940000000
        000080464000000000004053400000000000003840000000000000F03F000000
        0000005D4000000000000041400000000000002A400000000000003140000000
        0000C05540000000000000144000000000000044400000000000804340000000
        0000005540000000000040684000000000004071400000000000C06A40000000
        00004067400000000000707040}
    end
    object ChartTool1: TPageNumTool
      Callout.Brush.Color = clBlack
      Callout.Arrow.Visible = False
      Shape.CustomPosition = True
      Shape.Left = 450
      Shape.Top = 10
      Text = '第 %d 页共 %d 页'
      Format = '第 %d 页共 %d 页'
    end
  end
end
View Code

功能代码:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeEngine, TeeTools, TeePageNumTool, Series, TeeProcs, Chart,
  StdCtrls, TeeScroB, TeeNavigator, TeeEdiGene, ExtCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    Button2: TButton;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    ChartPageNavigator1: TChartPageNavigator;
    ChartScrollBar1: TChartScrollBar;
    Chart1: TChart;
    Series1: TLineSeries;
    ChartTool1: TPageNumTool;
    procedure FormCreate(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure CheckBox3Click(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);
begin
  Self.Caption := '图表的滚动与翻页';
  Self.Position := poScreenCenter;
  Series1.FillSampleValues(1000);
  Chart1.MaxPointsPerPage := 20;   //每页最大点数
  ChartScrollBar1.Min := 1;
  ChartScrollBar1.Max := 60;       //最大页数
  ChartScrollBar1.Position := 1;
  ChartScrollBar1.PageSize := 1;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  Series1.Marks.Visible := CheckBox1.Checked;
end;

procedure TForm1.CheckBox2Click(Sender: TObject);
begin
  Series1.Pointer.Visible := CheckBox2.Checked;
end;

procedure TForm1.CheckBox3Click(Sender: TObject);
begin
  Chart1.View3D := CheckBox3.Checked;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ChartScrollBar1.Position := 1;
  Button1.Enabled := False;
  Button2.Enabled := True;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  ChartScrollBar1.Position := ChartScrollBar1.Max;
  Button1.Enabled := True;
  Button2.Enabled := False;
end;

end.
View Code

 

posted on 2020-02-26 21:56  丶愤怒的蘑菇  阅读(487)  评论(0编辑  收藏  举报