source: WorldVistAEHR/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDUG.m@ 1764

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

initial load of WorldVistAEHR

File size: 3.9 KB
Line 
1KMPDUG ;OAK/RAK - CM Tools Graph Utility ;2/17/04 09:57
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;;Mar 22, 2002
3 ;
4EN(KMPUAR,KMPUTI,KMPUOPT,KMPUSTRT,KMPUTAR,KMPUXIT,KMPUMAX) ;entry point
5 ;-----------------------------------------------------------------------
6 ; KMPUAR.. Local or global array (passed by value) that contains graph
7 ; information in the format:
8 ;
9 ; KMPUAR(...,0)=DataTitle^DataValue
10 ; piece 1 - the title of the data
11 ; piece 2 - the actual value of the data
12 ;
13 ; KMPUTI.. graph titles in 4 up-arrow pieces
14 ; piece 1 - title of the graph
15 ; piece 2 - second title of graph (if any)
16 ; piece 3 - x axis title
17 ; piece 4 - y axis title
18 ;
19 ; KMPUOPT. (optional) A string of one or more letters representing
20 ; desired options.
21 ; "A" - angle titles (only for vertical graph)
22 ; "D" - double space
23 ; "G" - print grid across graph
24 ; "S" - display entries with MAX>9999 in scientific notation
25 ; "V" - display 'vertical' graph
26 ;
27 ; KMPUSTRT (optional). Number to start graph.
28 ; if KMPUSTRT=0 first hash mark of graph will equal 0
29 ;
30 ; KMPUTAR. (optional) Text array. Local or global array that
31 ; contains text to be displayed with the graph.
32 ;
33 ; Example: KMPUTAR="UTIL($J,"
34 ; KMPUTAR="^ASK(999999,23,10,"
35 ; KMPUTAR="^TMP($J,""TEXT"","
36 ;
37 ; KMPUXIT. (optional) Exit without 'continue' text. This allows the
38 ; programmer to use their own display for continuing
39 ; 0 - do not exit - display 'continue' text
40 ; 1 - exit
41 ;
42 ; KMPUMAX. (optional) Maximum scale - if not defined, the maximum value
43 ; is determined from the data passed. If KMPUMAX is defined,
44 ; scale will be adjusted accordingly.
45 ;-----------------------------------------------------------------------
46 ;
47 I '$D(KMPUAR) W !!?7,"...no array data...",!! D CONT Q
48 S KMPUSTRT=+$G(KMPUSTRT),KMPUOPT=$$UP^XLFSTR($G(KMPUOPT))
49 S KMPUXIT=+$G(KMPUXIT),KMPUMAX=+$G(KMPUMAX)
50 K:$G(KMPUTAR)="" KMPUTAR
51 I '$D(@KMPUAR) D Q
52 .W *7,!!?7,"...no information to graph...",!!
53 .D CONT
54 S DTIME=$S($D(DTIME):DTIME,1:600)
55 ;
56 N BAR,BOTTOM,DATA,DEC,DEC1,DIV,DIVT,DNUM,DX,DY,END,GWIDTH,I,I1,LABEL,MAX
57 N MIN,NUM,OFFSET,SCALE,STEP,TEXT,TITLE,X,XCOORD,XTITLE,YNUM,YTITLE,Z
58 N IOBLC,IOBRC,IOBT,IOG1,IOG0,IOHL,IOLT,IOMT,IORT,IOTLC,IOTRC,IOTT,IOVL
59 N IOINHI,IOINLOW,IORVOFF,IORVON,IOUOFF,IOUON
60 ;
61 D INIT^KMPDUG1 I KMPUOPT["D",(KMPUOPT'["V"),(YNUM>8) D Q
62 .W *7,!!?7,"...too many data elements to double space on a terminal"
63 .W !?7," for a Horizontal Graph..."
64 .W !!! D CONT
65 I KMPUOPT["D",(KMPUOPT["V"),(YNUM>34) D Q
66 .W *7,!!?7,"...too many data elements to double space on a terminal"
67 .W !?7," for a Vertical Graph..."
68 .W !!! D CONT
69 ; if not a terminal do printer routine
70 I $E(IOST)'="C" Q ;D EN^KMPUGP Q
71 I $G(IOG1)']""!($G(IOG0)']"") D Q
72 .W *7,!!?7,"...unable to place terminal in graphics mode...",!!
73 .D CONT
74 I 'MAX D Q
75 .W *7,!!?7,"...unable to determine any data to graph or data all zeros...",!!
76 .D CONT
77 ; if 'vertical' graph
78 I KMPUOPT["V" D EN^KMPDUGV Q
79 ; draw graph - display titles - display data
80 D DRAW^KMPDUG1,TITLES^KMPDUG1,DATA
81 ; if text to display.
82 I $D(KMPUTAR) D WP^KMPDU11(KMPUTAR,(BOTTOM+5),24) Q
83 D:'KMPUXIT CONT
84 Q
85 ;
86CONT ;-- hold screen
87 S DX=(IOM-23\2),DY=(IOSL-1) X IOXY
88 R "Press <RET> to continue",X:DTIME
89 Q
90 ;
91DATA ;-- display data in graph.
92 W IOG0 S DY=$S(KMPUOPT["D":1,1:2),BAR=0,I=""
93 F S I=$O(@KMPUAR@(I)) Q:I="" I $D(@KMPUAR@(I,0)) S DATA=@KMPUAR@(I,0) D
94 .S XCOORD=$P(DATA,U,2),END=(XCOORD-KMPUSTRT-STEP)
95 .S DX=16,DY=DY+$S(KMPUOPT["D":2,1:1)
96 .; if no data quit
97 .Q:$P(@KMPUAR@(I,0),U,2)']""
98 .F I1=0:STEP:END X IOXY W @BAR(BAR),! S DX=DX+1 Q:DX=68
99 .; print value in parenthesis
100 .S DX=69 X IOXY W "<",$J((XCOORD/DIV),$L($FN((MAX/DIV),"",DEC)),DEC),">"
101 .S BAR=$S(BAR=1:0,1:1)
102 Q
Note: See TracBrowser for help on using the repository browser.