source: WorldVistAEHR/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDUGV.m@ 1742

Last change on this file since 1742 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1KMPDUGV ;OAK/RAK - CM Tools Vertical Graph Utility ;2/17/04 10:00
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;;Mar 22, 2002
3 ;
4EN ;-- entry point.
5 D DRAW,TITLES,DATA W IOG0
6 I $D(KMPUTAR) D Q
7 .;D WP^KMPDU11(KMPUTAR,5,24,(RIGHT+5),IOM,0,$G(KMPUXIT))
8 .D WP^KMPDU11(KMPUTAR,18,22,5,IOM,0,$G(KMPUXIT))
9 D:'KMPUXIT CONT^KMPDUG
10 Q
11 ;
12DATA ;-- display data in graph.
13 W IOG0 S DX=$S(KMPUOPT["D":9,1:10),BAR=0,I=""
14 F S I=$O(@KMPUAR@(I)) Q:I="" I $D(@KMPUAR@(I,0)) S DATA=@KMPUAR@(I,0) D
15 .S XCOORD=$P(DATA,U,2),END=(XCOORD-KMPUSTRT) ;-STEP)
16 .S DY=14,DX=DX+$S(KMPUOPT["D":2,1:1)
17 .; if no data quit
18 .Q:$P(@KMPUAR@(I,0),U,2)']""
19 .F I1=0:STEP:END X IOXY W @BAR(BAR),! S DY=DY-1 Q:DY=5
20 .S BAR=$S(BAR=1:0,1:1)
21 Q
22 ;
23DRAW ;-- draw graph.
24 S RIGHT=$S(KMPUOPT["D":(YNUM*2),1:(YNUM+1))+10
25 W @IOF,!,IOG1 S DX=10
26 ; draw left line
27 F I=1:1:6 S DY=4+I X IOXY W IOVL S DY=15-I X IOXY W IOVL
28 ; draw left top corner ;and bottom corners
29 ;S DY=4 X IOXY W IOTLC ;S DY=15 X IOXY W IOBLC,!
30 ; draw top and bottom lines
31 ;F DX=(DX+1):1:(RIGHT-1) S DY=5 X IOXY W IOHL,! S DY=15 X IOXY W "s",!
32 F DX=(DX+1):1:(RIGHT-1) S DY=14 X IOXY W "s",!
33 ; draw right top corner ;and bottom corners
34 ;S DX=RIGHT,DY=5 X IOXY W IOTRC ;S DY=15 X IOXY W IOBRC,!
35 ; draw right line
36 S DX=RIGHT F I=1:1:6 S DY=4+I X IOXY W IOVL S DY=16-I X IOXY W IOVL
37 ; draw 'hash marks' on left line for relative values
38 S DX=9,DY=14 X IOXY W "s",! ;W IOLT,!
39 F DY=13:-1:4 X IOXY W "s",! ;W IOMT,!
40 ; print grid
41 I KMPUOPT["G" F DY=14:-1:4 F DX=11:1:(RIGHT-1) X IOXY W "s",!
42 W IOG0
43 Q
44 ;
45TITLES ;-- print graph titles.
46 W IOG0
47 ; print first and second line of title
48 S DX=(IOM-$L($P(TITLE,U))\2+1),DY=0 X IOXY W $P(TITLE,U),!
49 S DX=(IOM-$L($P(TITLE,U,2))\2+1),DY=1 X IOXY W $P(TITLE,U,2),!
50 ; print x title at bottom
51 S DX=(10-$L(XTITLE)),DY=3 X IOXY W IOUON,XTITLE,IOUOFF
52 ; if div>1 write (x div)
53 W:DIV>1 " <x",DIVT,">"
54 W !
55 ; print y title
56 S DY=15,DX=$S(KMPUOPT["A":1,1:2)
57 F I=1:1:8 D
58 .X IOXY W IOUON,$E(YTITLE,I),IOUOFF,! S DY=DY+1
59 .I KMPUOPT["A" S DX=DX+1
60 ; print relative values next to hash marks
61 S NUM=(SCALE+KMPUSTRT)
62 S DY=14,DX=9-$L($FN((KMPUSTRT/DIV),"",DEC1))
63 X IOXY W $FN((KMPUSTRT/DIV),"",DEC1),!
64 F DY=13:-1:4 D
65 .S DX=(9-$L($FN((NUM/DIV),"",DEC1)))
66 .X IOXY W $FN((NUM/DIV),"",DEC1),! S NUM=NUM+SCALE
67 ; print data titles
68 S ZDX=11,I=""
69 F S I=$O(@KMPUAR@(I)) Q:I="" I $D(@KMPUAR@(I,0)) D
70 .S YTITLE=$E($P(@KMPUAR@(I,0),U),1,14),DX=ZDX
71 .I KMPUOPT["A" F I1=1:1:8 S DY=14+I1 X IOXY W $E(YTITLE,I1),! S DX=DX+1
72 .I KMPUOPT'["A" F I1=1:1:8 S DY=14+I1 X IOXY W $E(YTITLE,I1),!
73 .S ZDX=ZDX+$S(KMPUOPT["D":2,1:1)
74 Q
Note: See TracBrowser for help on using the repository browser.