欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

TChart-图表的滚动与翻译

程序员文章站 2022-06-09 17:13:35
界面代码: object Form1: TForm1 Left = 202 Top = 182 Width = 1305 Height = 675 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Colo ......

TChart-图表的滚动与翻译

 

 

 界面代码:

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

功能代码:

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.