program PieHisto; {$I typedef.bic} {these files must be} {$I graphix.bic} {included and in this order} {$I kernel.bic} {$I grdisk.bic} {$I hatch.hgh} {$I histogrm.hgh} procedure PieHistoDem; var i,n:integer; a:PieArray; b:PlotArray; ch:char; NumText:WrkString; max_b:real; scale:integer; begin n:=5; {the number of data points} a[1].area:=25; {initialize the pie array} a[2].area:=17.5; a[3].area:=9.6; a[4].area:=21; a[5].area:=35; a[1].text:='JAN. '; a[2].text:='FEB. '; a[3].text:='MAERZ'; a[4].text:='APR.'; a[5].text:='MAI '; for i:=1 to n do {init the histogram array} b[i,2]:=a[i].area; max_b:=b[1,2]; for i:=1 to n do if b[i,2]>max_b then max_b:=b[i,2]; ClearScreen; DefineWindow(3,10,30,70,199); DefineWorld(3,0,max_b,10,0); SelectWorld(3); SelectWindow(3); DrawHistogram(b,n,true,6); DrawLine(0,max_b,10,max_b); DrawLine(10,max_b,10,b[n,2]); ClippingGlb:=false; if n>5 then scale:=1 else scale:=2; for i:=1 to n do {draw the bar chart lables} begin DrawText(WindowX((10/n)*(i-1)),10,scale,' '+a[i].text); {draw the text} str(a[i].area:6:2,NumText); {format the number} DrawText(WindowX((10/n)*(i-1)),11+6*scale,scale,' '+NumText); {draw the number} end; end; begin InitGraphic; {initialize the graphics system} PieHistoDem; {do the demo} readln; LeaveGraphic; end.