home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d09xx
/
d0925.lha
/
DonsGenies
/
FrenchGenies.lha
/
Rexx
/
HistogrammeHorizontal.pprx
< prev
next >
Wrap
Text File
|
1993-08-03
|
4KB
|
176 lines
/*@BHsitogramme Horizontal @P@I⌐ Michael S. Fahrion. Janvier 1992
DΘbuggΘ et amΘliorΘ par Don Cox.
Ce GΘnie crΘe un histogramme horizontal α partir des donnΘes fournies par
l'utilisateur.
*/
numeric digits 8
cr = '0a'x
call SafeEndEdit.rexx()
call ppm_AutoUpdate(0)
call ppm_NewGroup()
units = ppm_GetUnits()
call ppm_SetUnits(1)
signal on halt
signal on break_c
signal on break_e
signal on break_d
box = ppm_ClickOnBox("Cliquez sur la boεte destinΘe α contenir l'histogramme...")
if box = 0 then
do
call ppm_Inform(1, "Aucune boεte n'est sΘlectionnΘe",)
call ppm_ClearStatus()
exit
end
/* extract box attributes */
boxsize = ppm_GetBoxSize(box)
boxpos = ppm_GetBoxPosition(box)
if ppm_Inform(2, "Effacer cette boεte ?",) = 1 then call ppm_DeleteBox(box)
boxwidth = word(boxsize, 1)
boxheight = word(boxsize, 2)
boxleft = word(boxpos, 1)
boxtop = word(boxpos, 2)
/* trace(results) */
nmbars = GetUserText(4, "Nombre de donnΘes")
if nmbars > 12 then exit_msg("Le nombre de donnΘes ne doit pas Ωtre supΘrieur α 12")
form = ' DonnΘe 1'
do x = 2 while x <= nmbars
form = form cr 'DonnΘe' x
end
form = form cr 'Echelle'
form = ppm_GetForm("DonnΘes de l'histogramme",6,form)
if form = "" then exit_msg("OpΘration annulΘe")
x = 1
do forever
parse var form bdata.x '0a'x form
if bdata.x = "" then leave
x = x + 1
end
tchart = nmbars + 1
topchart = bdata.tchart
form = ' LΘgende 1'
do x = 2 while x <= nmbars
form = form cr 'LΘgende' x
end
form = ppm_GetForm("LΘgendes de l'histogramme",8,form)
if form = "" then exit_msg("OpΘration annulΘe")
x = 1
do forever
parse var form blabel.x '0a'x form
if blabel.x = "" then leave
x = x + 1
end
facelist = ppm_GetTypeFaceList()
facelist = substr(facelist, pos('0a'x, facelist) +1) /*strip off the number*/
face = ppm_SelectFromList("Choix de la Police",32,18,0,facelist)
/* Draw background chart and grid lines */
barbottom = boxtop + boxheight
call ppm_ShowStatus("CrΘation de l'histogramme")
linespace = boxwidth / 10
gridline = linespace + boxleft
call ppm_SetLineWeight(.5)
do 9
call ppm_DrawLine(gridline, boxtop, gridline, boxtop + boxheight)
gridline = gridline + linespace
call ppm_AddToGroup()
end
call ppm_SetLineWeight(1)
call ppm_SetFillPattern(0)
call ppm_DrawRect(boxleft, boxtop, boxleft + boxwidth, boxtop + boxheight)
call ppm_AddToGroup()
call ppm_MergeGroup()
/* add chart numbers */
call ppm_ShowStatus("Mise en place de l'Θchelle de l'histogramme")
call ppm_SetFont(face)
call ppm_SetSize(10)
call ppm_SetStyle(N)
call ppm_SetJustification(2)
bleft = (boxleft + boxwidth - .25)
btop = boxtop + boxheight + .05
ctext = topchart
ctextadjust = topchart / 10
i = 1
do 11
cbox = ppm_CreateBox(bleft, btop, .5, .25, 0)
bleft = bleft - linespace
call ppm_TextIntoBox(cbox, ctext)
ctext = topchart - (ctextadjust * i)
i = i + 1
end
/* Draw chart bars */
barcalc = boxwidth / topchart
barspace = (nmbars + 1) * .125
barwidth = (boxheight - barspace) / nmbars
barpos = boxtop + .125
call ppm_SetFillPattern(5)
i = 1
do nmbars
call ppm_ShowStatus("Travail en cours sur la donnΘe : " i)
barlength = bdata.i * barcalc
barlength = boxleft + barlength
call ppm_DrawRect(boxleft, barpos, barlength, barpos + barwidth)
call ppm_SetJustification(1)
cbox = ppm_CreateBox(boxleft - .53, barpos, .5, .25, 0)
call ppm_TextIntoBox(cbox, upper(blabel.i))
call ppm_SetJustification(0)
cbox = ppm_CreateBox(barlength + .05, barpos, .3, .15, 0)
call ppm_SetBoxTransparent(cbox,0)
call ppm_TextIntoBox(cbox, bdata.i)
barpos = barpos + barwidth + .125
i = i + 1
end
exit_msg("TerminΘ")
break_d:
break_e:
break_c:
halt:
call exit_msg("Abandon du GΘnie par l'utilisateur !")
exit_msg: procedure expose units
do
parse arg message
call ppm_ClearStatus()
if message ~= '' then
call ppm_Inform(1, message,)
call ppm_SetUnits(units)
call ppm_ClearStatus()
call ppm_AutoUpdate(1)
exit
end