Sample program: |
The following sample code displays a number of data points both as a diagram and a table:
program ChartsTablesMemos;
const
NData = 30; // number of data points
var
i : integer;
x, v : double;
begin
ChartBook.Reset;
ChartBook.Configure (1,true,true,true,200,300);
ChartBook.Tables[1].CommonHeader := 'Table of Sines';
ChartBook.Tables[1].NrOfColumns := 2;
ChartBook.Tables[1].NrOfRows := NData;
ChartBook.Tables[1].Header[1] := 'Argument';
ChartBook.Tables[1].Header[2] := 'sin(x)';
with ChartBook.Charts[1] do
begin
MoveTo (0,0);
for i:=1 to NData do
begin
x := 0.3*i;
v := sin(x);
DrawTo (x,v);
MarkAt (x,v,26);
ChartBook.Tables[1].Elem[1,i] := strff(x,1,2);
ChartBook.Tables[1].Elem[2,i] := strff(v,1,4);
end;
AutoRange(0,2);
Update;
end;
ChartBook.Tables[1].FitAllColWidths (2, true, 4, 100, 1);
ChartBook.Memos[1].Text := 'This examples shows how to '+
'display a set of data points both as a '+
'graph and in tabular form.';
ChartBook.Memos[1].Scrollbars := ssVertical;
ChartBook.Memos[1].WordWrap := true;
ChartBook.Memos[1].Color := $CCFFEE;
end.
|