SOURCE Keyword
The SOURCE
keyword specifies the source of the
graph specification.
INLINE. An inline graph specification follows the GGRAPH
command. Currently, the BEGIN GPL/END GPL
block
is used for the inline graph specification. This block must follow
the GGRAPH
command, and there must be as many blocks
as there are GRAPHSPEC
subcommands with SOURCE=INLINE
. See the topic BEGIN GPL-END GPL for more information. See Overview (BEGIN GPL-END GPL command) for limitations.
GPLFILE ("filespec"). Use the specified GPL file as the graph specification. See the GPL documentation for more details about GPL. The examples in the GPL documentation may look different compared to the syntax pasted from the Chart Builder. The main difference is in when aggregation occurs. See Working with the GPL (GGRAPH command) below for information about the differences. See GPL Examples (GGRAPH command) for examples with GPL that is similar to the pasted syntax.
VIZMLFILE ("filespec"). Use the specified ViZml file as the graph specification. You can save ViZml from the Chart Editor. See the topic Saving the Chart as XML for more information.
See the ViZml documentation for more details about ViZml.
VIZTEMPLATE(NAME="template name"[LOCATION=LOCAL]. MAPPING(templatemapping)). Use the specified visualization template and mapping as the graph specification.
VIZTEMPLATE(NAME="template name"[LOCATION="repository folderspec"] . MAPPING(templatemapping)). Use the specified visualization template and mapping as the graph specification.
VIZTEMPLATE(NAME="filespec"[LOCATION=FILE]. MAPPING(templatemapping)). Use the specified visualization template and mapping as the graph specification.
The LOCATION
qualifier specifies the location
in which to find the named template. You specify whether the template
is a local imported template, is obtained from a specific IBM® SPSS® Collaboration and Deployment Services Repository, or is stored in a arbitrary location on the file system. Note
that a visualization template is not the same as a template for use
with the TEMPLATE
keyword.
The template mapping is a series of key-value pairs separated by
spaces. An example is MAPPING("Categories"="jobcat" "Summary"="Count")
.
- The key is a slot defined by the template, and the value is a variable or string assigned to the slot.
- If a variable is renamed in the
VARIABLES
keyword using the[NAME="name"]
qualifier, the value refers to the rename, not the original name. - In the example, the keys are
Categories
andSummary
, and the respective values arejobcat
andCount
. - Individual keys and values are enclosed in quotes.
- Each value can also be followed by the qualifier
[DATASET="dataset name"]
to indicate a variable's dataset. - At this time, only one dataset can be used with each template.
- To determine valid slot names, open the Graphboard Template Chooser, add variables to slots of interest, and paste the syntax. You can access the Template Chooser by selecting Graphboard Template Chooser from the Graphs menu. Visualization templates on the file system are not available in the Graphboard Template Chooser. You will have to import them first, or you will have to open them in a text editor to determine the slot names.
New templates can be created with the separate IBM SPSS Visualization Designer product. The GGRAPH
command can use these
templates if they are stored in the IBM SPSS Collaboration and Deployment Services Repository or if they are imported using the Graphboard Template Chooser.
Note: When using a visualization template, it is recommended
that you include DEFAULTTEMPLATE=NO
. This setting
will prevent the default template from overriding the styles in the
visualization template.
- If you received a template and want to reference it in syntax, you must first manually import it with the Graphboard Template Chooser to make it a local template.
- For built-in or imported templates, set the location to
LOCAL
. - For templates stored in a IBM SPSS Collaboration and Deployment Services Repository, use a IBM SPSS Collaboration and Deployment Services Repository file specification. For more information about IBM SPSS Collaboration and Deployment Services Repository file specifications, see File Specifications for IBM SPSS Collaboration and Deployment Services Repository Objects .
- For templates stored on the file system, set the location to
FILE
and specify the full path to the visualization template file withNAME
.
Examples
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat COUNT()
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: jobcat=col(source(s), name("jobcat"), unit.category())
DATA: count=col(source(s), name("COUNT"))
GUIDE: axis(dim(1), label("Employment Category"))
GUIDE: axis(dim(2), label("Count"))
ELEMENT: interval(position(jobcat*count))
END GPL.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat COUNT()
/GRAPHSPEC SOURCE=GPLFILE("simplebarchart.gpl").
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat COUNT()
/GRAPHSPEC SOURCE=VIZMLFILE("simplebarchart.xml").
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat
/GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="Bar"
MAPPING("Categories"="jobcat" "Summary"="Count"))
DEFAULTTEMPLATE=NO.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=salbegin salary gender[NAME="sex"]
/GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="Binned Scatter"[LOCATION="SPSSCR:///viz/templates"]
MAPPING("X"="salbegin"[DATASET="graphdataset"]
"Y"="salary"[DATASET="graphdataset"]
"Panel across"="sex"[DATASET="graphdataset"]))
DEFAULTTEMPLATE=NO.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=salbegin salary gender[NAME="sex"]
/GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="/vizfiles/MyBinnedScatter.viztemplate"[LOCATION=FILE]
MAPPING("X"="salbegin"[DATASET="graphdataset"]
"Y"="salary"[DATASET="graphdataset"]
"Panel across"="sex"[DATASET="graphdataset"]))
DEFAULTTEMPLATE=NO.