(Gast)
n/a Beiträge
|
Re: Probleme mit TChart
2. Apr 2007, 21:00
Ist jetzt dummerweise nicht kommentiert...
Delphi-Quellcode:
var
statistiken: Tstatistiken; statsini: Tinifile;
implementation
uses Unit1;
{$R *.dfm}
function Tstatistiken.GetToken(aString, SepChar: string; TokenNum: Byte): string;
var Token: string; StrLen: Byte; Num: Byte; EndofToken: Byte;
begin
StrLen := Length(aString); Num := 1; EndofToken := StrLen;
while ((Num <= TokenNum) and (EndofToken <> 0)) do begin
EndofToken := Pos(SepChar, aString); if EndofToken <> 0 then begin
Token := Copy(aString, 1, EndofToken - 1); Delete(aString, 1, EndofToken); Inc(Num);
end else Token := aString; end; if Num >= TokenNum then Result := Token else Result := '';
end;
function tnd : Integer;
var rec: Integer;
begin
rec := strtoint(Trim(form1.GetToken(datetostr(now),'.',1)));
rec := rec * 1;
result := rec;
end;
function tnm : Integer;
var rec: Integer;
begin
rec := strtoint(Trim(form1.GetToken(datetostr(now),'.',2)));
rec := rec * 1;
result := rec;
end;
function tny : Integer;
var rec: Integer;
begin
rec := strtoint(Trim(form1.GetToken(datetostr(now),'.',3)));
rec := rec * 1;
result := rec;
end;
procedure Tstatistiken.FormCreate(Sender: TObject);
begin
statsini:=TIniFile.create(ExtractFilePath(ParamStr(0))+'/stats/login.dat');
end;
procedure Tstatistiken.Button4Click(Sender: TObject);
var I, I2: Integer;
sstring: array[1..3] of String;
begin
sstring[1] := '.'+inttostr(tnm)+'.'+inttostr(tny);
case tnm of
1: begin sstring[2] := '.12.'+inttostr(tny-1); sstring[3] := '.11.'+inttostr(tny-1); end;
2: begin sstring[2] := '.'+inttostr(tnm-1)+'.'+inttostr(tny-1); sstring[3] := '.11.'+inttostr(tny-1); end;
3: begin sstring[2] := '.'+inttostr(tnm-1)+'.'+inttostr(tny-1); sstring[3] := '.12.'+inttostr(tny-1); end;
4: begin sstring[2] := '.'+inttostr(tnm-1)+'.'+inttostr(tny); sstring[3] := '.'+inttostr(tnm-2)+'.'+inttostr(tny); end;
5: begin sstring[2] := '.'+inttostr(tnm-1)+'.'+inttostr(tny); sstring[3] := '.'+inttostr(tnm-2)+'.'+inttostr(tny); end;
6: begin sstring[2] := '.'+inttostr(tnm-1)+'.'+inttostr(tny); sstring[3] := '.'+inttostr(tnm-2)+'.'+inttostr(tny); end;
7: begin sstring[2] := '.'+inttostr(tnm-1)+'.'+inttostr(tny); sstring[3] := '.'+inttostr(tnm-2)+'.'+inttostr(tny); end;
8: begin sstring[2] := '.'+inttostr(tnm-1)+'.'+inttostr(tny); sstring[3] := '.'+inttostr(tnm-2)+'.'+inttostr(tny); end;
9: begin sstring[2] := '.'+inttostr(tnm-1)+'.'+inttostr(tny); sstring[3] := '.'+inttostr(tnm-2)+'.'+inttostr(tny); end;
10: begin sstring[2] := '.'+inttostr(tnm-1)+'.'+inttostr(tny); sstring[3] := '.'+inttostr(tnm-2)+'.'+inttostr(tny); end;
11: begin sstring[2] := '.'+inttostr(tnm-1)+'.'+inttostr(tny); sstring[3] := '.'+inttostr(tnm-2)+'.'+inttostr(tny); end;
12: begin sstring[2] := '.'+inttostr(tnm-1)+'.'+inttostr(tny); sstring[3] := '.'+inttostr(tnm-2)+'.'+inttostr(tny); end;
end;
for I := 1 to 3 do
begin
for I2 := 1 to 31 do
begin
TLineSeries(findcomponent('Series'+inttostr(I))).Add(statsini.ReadInteger(inttostr(I2)+sstring[I], 'userlogin', 0));
end;
end;
end;
end.
|
|
Zitat
|