Previous Topic: Redrawing the Graph

Next Topic: Customizing Special CA Automation Point Files


Sample PLOT Statements in a REXX Program

The following listing shows typical PLOT command statements that you could place in a REXX program to create a graph called MYPLOT. To better illustrate the operations necessary for plotting a graph, the code fragment shown does not contain miscellaneous REXX processing statements and does not check PLOT command return codes.

/* This statement erases any existing graph data*/
"PLOT MYPLOT DELETE GRAPH"

/* Define basic graph appearance */
"PLOT MYPLOT DEFINE GRAPH WINDOW(PLOTWIN)"

"PLOT MYPLOT DEFINE GRAPH",
     "AXIS(XAXIS, COLOR(TURQUOISE), TYPE(TIME))",
     "AXIS(YAXIS, COLOR(TURQUOISE), TYPE(NUMERIC))"
"PLOT MYPLOT DEFINE GRAPH BACKGROUND(PLOTAREA,COLOR(BLACK))",
   "BACKGROUND(LABELAREA,COLOR(BLACK))"

"PLOT MYPLOT DEFINE GRAPH",
   "LABEL(TITLE, 'Test of Graph Facility',COLOR(RED))"
"PLOT MYPLOT DEFINE GRAPH",
   "LABEL(YAXIS,'STSO',COLOR(RED))",
   "LABEL(YAXIS,'STSO-LINE 2',COLOR(BRIGHT PURPLE),LINE(2))"
"PLOT MYPLOT DEFINE GRAPH",
   "LABEL(XAXIS,'XAXIS',COLOR(BRIGHT GREEN))",
   "LABEL(XAXIS,'XAXIS-line2',COLOR(yellow),LINE(2))"
"PLOT MYPLOT DEFINE GRAPH",
   "SCALE(XAXIS,0:00,23:59,04:00)",
   "SCALE(YAXIS,0,10,1)"

/* Define lines or bars to represent information */
"PLOT MYPLOT DEFINE LINE LINE1 COLOR(YELLOW)"
"PLOT MYPLOT DEFINE LINE LINE2 COLOR(RED)"
"PLOT MYPLOT DEFINE LINE LINE3 COLOR(PURPLE)"
"PLOT MYPLOT DEFINE BAR  BAR1  COLOR(BRIGHT GREEN)"

/* Insert data into graph */
"PLOT MYPLOT INSERT DATA LINE1 XY(00:00,1) XY(04:00,2) XY(08:00,3),
     XY(12:00,4) XY(16:00,5) XY(20:00,4) XY(23:59,3)"
"PLOT MYPLOT INSERT DATA LINE2 XY(00:00,5) XY(04:00,4) XY(08:00,3),
     XY(12:00,2) XY(16:00,3) XY(20:00,4) XY(23:59,3)"
"PLOT MYPLOT INSERT DATA LINE3 XY(00:00,5) XY(04:00,4) XY(08:00,5),
     XY(12:00,4) XY(16:00,3) XY(20:00,2) XY(23:59,1)"
"PLOT MYPLOT INSERT DATA BAR1  XY(00:00,1) XY(04:00,1) XY(08:00,1),
     XY(12:00,4) XY(16:00,2) XY(20:00,2) XY(23:59,2)"

/* Draw the graph */
"PLOT MYPLOT DRAW"
/* Delete old data from the midnight shift */
"PLOT MYPLOT DELETE DATA BAR1 RANGE(XAXIS,0:00,08:00)"
/* Redraw the graph */
"PLOT MYPLOT DRAW"