ggraph through menus?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ggraph through menus?

Robert L

Hi!

 

One of my clients wants to describe a small set of patients before and after treatment. I have shown a chart with double axes which follows from this syntax:

 

DATA LIST LIST (",")/ nr before after.

BEGIN DATA

1, 11,13

2, 12,12

3, 10,13

4, 11,12

END DATA.

 

DATASET NAME data.

 

DATASET ACTIVATE data.

 

GGRAPH

/GRAPHDATASET  NAME="data" VARIABLES=nr before after

/GRAPHSPEC SOURCE=INLINE.

BEGIN GPL

SOURCE: s = userSource(id("data"))

DATA: before=col(source(s), name("before"))

DATA: after=col(source(s), name("after"))

DATA: nr=col(source(s), name("nr"), unit.category())

TRANS: caseid = index()

COORD: parallel()

SCALE: y1=linear(dim(1), min(10), max(14))

SCALE: y2=linear(dim(2), min(10), max(14))

GUIDE: axis(scale(y1), label("Before"))

GUIDE: axis(scale(y2), label("After"))

ELEMENT: line(position(before*after),

              split(caseid), color(nr),

              transparency(transparency."0.5"))

END GPL.

 

This works, but this client is not too keen on using syntax yet, so I wonder how I could achieve this graph by using menus. So far, everything I have done with ggraph syntax has been possible to make with menus as well, and I guess it's the same here. Haven't found out how yet. Any suggestions?           

 

(BTW: the syntax above results in a graph where the axes are not properly aligned, but that has been corrected with a template.)

 

Robert

Robert Lundqvist
Reply | Threaded
Open this post in threaded view
|

Re: ggraph through menus?

Jon K Peck
Parallel coordinates are available via Graphs>Graphboard Template Chooser, but if you want to prewire a lot of settings to match your example syntax, it would be very easy to wrap this syntax in a custom dialog.  There are a great many features of GPL that are not provided via the menus.

In outline, assuming that only the variable names need to change, you would create a custom dialog with one source list and three single-variable target lists.  Assume that the target list are named nr, before, after .  Then you paste your syntax into the syntax window of the CDB parameterized as below.

You choose where on the menus it should appear and what is should be called.

The user just needs then to install it via Utilities>Custom Dialogs>Install Custom Dialog, and off they go.

GGRAPH
/GRAPHDATASET  NAME="data" VARIABLES=%%nr%%  %%before%%  %%after%%
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s = userSource(id("data"))
DATA: before=col(source(s), name("%%before%%"))
DATA: after=col(source(s), name("%%after%%"))
DATA: nr=col(source(s), name("%%nr%%"), unit.category())
TRANS: caseid = index()
COORD: parallel()
SCALE: y1=linear(dim(1), min(10), max(14))
SCALE: y2=linear(dim(2), min(10), max(14))
GUIDE: axis(scale(y1), label("Before"))
GUIDE: axis(scale(y2), label("After"))
ELEMENT: line(position(before*after),
              split(caseid), color(nr),
              transparency(transparency."0.5"))
END GPL.

HTH,

Jon Peck (no "h")
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        Robert Lundqvist <[hidden email]>
To:        [hidden email]
Date:        10/17/2011 02:57 AM
Subject:        [SPSSX-L] ggraph through menus?
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi!
 
One of my clients wants to describe a small set of patients before and after treatment. I have shown a chart with double axes which follows from this syntax:
 
DATA LIST LIST (",")/ nr before after.
BEGIN DATA
1, 11,13
2, 12,12
3, 10,13
4, 11,12
END DATA.
 
DATASET NAME data.
 
DATASET ACTIVATE data.
 
GGRAPH
/GRAPHDATASET  NAME="data" VARIABLES=nr before after
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s = userSource(id("data"))
DATA: before=col(source(s), name("before"))
DATA: after=col(source(s), name("after"))
DATA: nr=col(source(s), name("nr"), unit.category())
TRANS: caseid = index()
COORD: parallel()
SCALE: y1=linear(dim(1), min(10), max(14))
SCALE: y2=linear(dim(2), min(10), max(14))
GUIDE: axis(scale(y1), label("Before"))
GUIDE: axis(scale(y2), label("After"))
ELEMENT: line(position(before*after),
              split(caseid), color(nr),
              transparency(transparency."0.5"))
END GPL.
 
This works, but this client is not too keen on using syntax yet, so I wonder how I could achieve this graph by using menus. So far, everything I have done with ggraph syntax has been possible to make with menus as well, and I guess it's the same here. Haven't found out how yet. Any suggestions?            
 
(BTW: the syntax above results in a graph where the axes are not properly aligned, but that has been corrected with a template.)
 
Robert