Plot is defined in class jzplot.

Public verbs are pd and plot.

Public nouns that specify the Windows form and isigraph control id:

Name

Description

Default

PForm

form id

plot

PFormhwnd

form handle

defined when the form is created

PId

isigraph control id

gs

Example: create two plots

The following draws two independent plots:

load 'jzplot'          NB. load plot class
a=: conew 'jzplot'     NB. create plot object a
b=: conew 'jzplot'     NB. create plot object b
plot__a */~ i:15       NB. draw plot in a
plot__b +./~ i:15      NB. draw plot in b

Example: add plot to a form

In this case, you need to define the public nouns PForm, PFormhwnd and PId. These override the default values.

require 'gtkwd jzplot' NB. load plot class (gtkwd only required by J7)

MYPLOT=: 0 : 0
pc myplot;
xywh 0 0 225 200;cc g0 isigraph ws_border rightscale bottommove;
xywh 231 3 40 12;cc close button leftmove rightmove;cn "Close";
pas 2 0;pcenter;
rem form end;
)

myplot_run=: 3 : 0
wd MYPLOT
loc=: conew 'jzplot'             NB. create plot object
PForm__loc=: 'myplot'            NB. define PForm in loc
PFormhwnd__loc=: wd 'qhwndp'     NB. define PFormhwnd in loc
PId__loc=: 'g0'                  NB. define PId in loc
'density' plot__loc 7|i.25 25    NB. draw plot on the form
wd 'pshow'
)

myplot_g0_paint=: 3 : 0
pd__loc 'show'                   NB. call show in paint handler
)

myplot_cancel=: myplot_close_button=: 3 : 0
destroy__loc''
wd 'pclose'
)

myplot_run''

Example: update a plot in a form

Continuing the previous example, suppose you need to update the plot, perhaps in response to a user interaction. You redraw the plot and then use glpaint '' to make the new plot visible:

myplot_g0_update =: 3 : 0
'density' plot__loc 5|i.25 25    NB. draw updated plot on the form
myplot_g0_paint ''               NB. call paint routine to draw pixels
glpaint_jgl2_ ''                 NB. copy updated pixels to the screen
)

Plot/Class (last edited 2012-03-23 02:25:23 by BillLam)