Home | OS/2 Software | Rexx | Plot a line in a VisProRexx graphwindow (Intermediate level)

Plot a line in a VisProRexx graphwindow (Intermediate level)

Contributed by: Doug Rickman, Global Hydrology and Climate Center, MSFC, NASA

This is aimed at intermediate REXX users.

I had trouble making the the 3.1 plotting tools do what I needed, so ..... This routine assumes that a panel has been created with an "IMAGE" object. When the panel is created its PM window ID is stored in the variable GraphWindowID. You will need to define the variables Max and Min ( the y axis value range ) and the variables InitialLine2P and LastLine2P ( the x axis value range)


 


/* Plot a single line */

Variable=arg(1)
Min=arg(2)
Max=arg(3)
trash=arg(4)
Color=arg(5)
Width=arg(6)
Type=arg(7)

xy=VpItem(GraphWindowID,'IMAGE','ITEMSIZE')
PARSE VAR xy xlimit ylimit

NPellsX=(XLimit)/(LastLine2P-InitialLine2P+1)
NPellsY=(YLimit)/(Max-Min)

x=1
y=0.995*(Elevation.InitialLine2P-Min)*NPellsY  +1
CALL VpItem GraphWindowID,'IMAGE','FORECOLOR',color

rc=VpDraw(GraphWindowID,'IMAGE','MOVE',x,y)
do i = InitialLine2P+1 to LastLine2P
   x=0.995*(i-InitialLine2P)*NPellsX + 1
   y=0.995*(Elevation.i-Min)*NPellsY +1
   rc=VpDraw(GraphWindowID,'IMAGE','LINE',x,y)
   end

return 1

/*The line type values for LINETYPE are listed below: */
/*                                                                           */
/*  1      Dot                        */
/*  2      Short dash             */
/*  3      Dash dot                */
/*  4      Double dot             */
/*  5      Long dash              */
/*  6      Dash, double dot    */
/*  7      Solid                      */
/*  8      Invisible                 */
/*  9      Alternate                */

/*
 o WHITE
 o BLACK
 o BLUE
 o RED
 o PINK
 o GREEN
 o CYAN
 o YELLOW
 o DARKGRAY
 o DARKBLUE
 o DARKRED
 o DARKPINK
 o DARKGREEN
 o DARKCYAN
 o BROWN
 o PALEGRAY
*/