Unit diagtpu; Interface uses graph; Procedure diagram(bfx,bfy,jax,jay:integer; Tomb:array of integer; elemszam:integer; tengely,felirat:boolean; szin:Byte); Implementation Procedure diagram(bfx,bfy,jax,jay:integer; Tomb:array of integer; elemszam:integer; tengely,felirat:boolean; szin:Byte); Var i,max : integer; nx,ny : real; s : string; Begin max:=Tomb[0]; For i:=1 to elemszam do if Tomb[i]>max then max:=Tomb[i]; ny:=(jay-bfy)/(max*1.1); nx:=(jax-bfx)/((elemszam+1)*1.1); SetFillStyle(1,szin); SetTextStyle(2,0,2); SetTextJustify(1,0); For i:=0 to elemszam do Begin Bar(bfx+round(nx*i), jay-round(ny*Tomb[i]), bfx+round(nx*(i+1)), jay); If felirat then Begin str(Tomb[i],s); outtextxy(bfx+round(nx*(i+0.5)),jay-3-round(ny*Tomb[i]),s); End; End; If tengely then Begin line(bfx,bfy,bfx,jay); line(bfx,jay,jax,jay); For i:=0 to elemszam do line(bfx+round(nx*(i+1)), jay-2,bfx+round(nx*(i+1)),jay+2); For i:=1 to max do line(bfx-2,jay-round(ny*i),bfx+2,jay-round(ny*i)); line(bfx,bfy,bfx-2,bfy+5); line(bfx,bfy,bfx+2,bfy+5); line(jax-5,jay-2,jax,jay); line(jax-5,jay+2,jax,jay); End; End; BEGIN END.