没有问题呀!
看看我的程序:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart, DbChart,
DB, DBTables;
type
TForm1 = class(TForm)
Table1: TTable;
DBChart1: TDBChart;
Series1: TLineSeries;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
k,iii: Integer;
b: double;
a: string;
begin
iii := Table1.RecordCount;
memo1.Lines.Clear;
for k:=0 to iii-1 do
begin
b:=series1.YValue[k];
a:=format('%8.2f',);
memo1.Lines.Add(a)
end;
end;
end.
object Form1: TForm1
Left = 192
Top = 107
Width = 544
Height = 375
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object DBChart1: TDBChart
Left = 0
Top = 0
Width = 329
Height = 273
BackWall.Brush.Color = clWhite
BackWall.Brush.Style = bsClear
Title.Text.Strings = (
'TDBChart')
TabOrder = 0
object Series1: TLineSeries
Marks.ArrowLength = 8
Marks.Visible = False
DataSource = Table1
SeriesColor = clRed
XLabelsSource = 'EmpNo'
Pointer.InflateMargins = True
Pointer.Style = psRectangle
Pointer.Visible = False
XValues.DateTime = False
XValues.Name = 'X'
XValues.Multiplier = 1
XValues.Order = loAscending
XValues.ValueSource = 'EmpNo'
YValues.DateTime = False
YValues.Name = 'Y'
YValues.Multiplier = 1
YValues.Order = loNone
YValues.ValueSource = 'Salary'
end
end
object Button1: TButton
Left = 32
Top = 288
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object Memo1: TMemo
Left = 336
Top = 0
Width = 185
Height = 281
Lines.Strings = (
'Memo1')
ScrollBars = ssVertical
TabOrder = 2
end
object Table1: TTable
Active = True
DatabaseName = 'DBDEMOS'
TableName = 'employee.db'
Left = 440
Top = 56
end
end