procedure TForm4.Button3Click(Sender: TObject);
const
BLOCK_SIZE = 1000;
var
Detection: array{[1..15000]} of thit;
f: textfile;
d, i, j, y, z: integer;
ex, cc: int64;
plik, dir, xxx: string;
dt: tdatetime;
Users: TStringList;
begin
Users := TStringList.Create;
Users.Duplicates := dupIgnore;
Users.Sorted := True;
Chart1.ClearSeries;
dir := GetCurrentDir;
chdir(dir + '\DATA');
if FileExists(label6.Caption ) =true then
begin
plik := label6.Caption;
AssignFile(f, plik);
reset(f);
i := 0;
SetLength(Detection, 0);
while not EOF(f) do
begin
if i mod BLOCK_SIZE = 0 then
SetLength(Detection, Length(Detection) + BLOCK_SIZE);
readln(f, Detection[i].time );
readln(f, Detection[i].lat );
readln(f, Detection[i].long );
readln(f, Detection[i].user_name );
readln(f, Detection[i].user_n );
readln(f, Detection[i].team_name );
readln(f, Detection[i].team_nr );
readln(f, xxx);
Users.Add(Detection[i].team_nr);
readln(f, xxx);
Inc(i);
end;
closefile(f);
SetLength(Detection, i);
SetLength(Series_ar, Users.Count);
z := 0;
label4.Caption := i.ToString;
for j := 0 to Users.Count - 1 do
begin
Series_ar[j] := TLineSeries.Create(Chart1);
Series_ar[j].ShowPoints := True;
Series_ar[j].Pointer.Brush.Color := rgb(Random(256), Random(256), Random(256));
Series_ar[j].Pointer.Pen.Color := clBlack;
Series_ar[j].Pointer.Style := psCircle;
Series_ar[j].Title := '';
Chart1.AddSeries(Series_ar[j]);
end;
d := 0;
for j := 0 to High(Detection) do
begin
d := Users.IndexOf(Detection[j].team_nr);
if d = -1 then
continue;
DT := unixToDateTime((Detection[j].time div 1000));
//Series_ar[d].AddXy(Detection[j].time, StrToInt(Detection[j].team_nr) );
Series_ar[d].AddXy( dt, StrToInt(Detection[j].team_nr));
Series_ar[d].Title := (Detection[j].team_name+ Detection[j].User_name);{<---?????}
end;
end;
chdir(dir);
Users.Free;
end;