Date: Mon, 1 Oct 2007 07:41:19 -0600
Reply-To: ViAnn Beadle <vab88011@gmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: ViAnn Beadle <vab88011@gmail.com>
Subject: Re: AW: GPL GGRAPH
In-Reply-To: <4700E3D5.5000208@gmail.com>
Content-Type: text/plain; charset="us-ascii"
Yes, it is a good trick. Unfortunately, it requires some knowledge of what a
template does and AFAIK the chart template is undocumented. A template is a
fragment of a chart which modifies the vizML which is the XML definition of
the chart. Note that you can get the schema from
xml.spss.com/spss/visualization and you can also save chart xml from the
editor if you want to experiment with vizml.
There are also some hand-crafted templates on the SPSS site which can add
special effects to the chart that aren't available otherwise. Go to
http://support.spss.com/Tech/Products/SPSS/Utilities/SPSSforWindows/template
s/index.html and take a look.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
Marta Garcia-Granero
Sent: Monday, October 01, 2007 6:11 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Re: AW: GPL GGRAPH
Hi Christian
This trick is absolutely great! (writing the chart template dinamically,
I mean). Thanks for it, I have already adapted it for one of my MACROS.
I love to keep on learning, and this list never dissapoints me!
Best regards,
Mart
> Do if $casenum = 1.
> WRITE OUTFILE='d:\temp\BackCol.sgt'
> /'<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
> /'<template SPSS-Version="2.2" '
> /' selectPath="12 " '
> /' xmlns="http://xml.spss.com/spss/visualization" '
> /' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
> /' xsi:schemaLocation="http://xml.spss.com/spss/visualization '
> /' http://xml.spss.com/spss/visualization/vizml-template-3.0.xsd">'
> /' <addFrame count="1" styleOnly="true" type="graph"> '
> /' <style color="transparent" color2="transparent"
visible="true"/> '
> /' <style color="#f8981d" color2="#000000" number="1"
visible="true"/> '
> /' </addFrame> '
> /'</template> '.
> End if.
> EXECUTE.
>
> You also could also change the template dynamically depending on your
data.
> I posted a while ago a syntax that adds a reference line dynamically
> (depending on the data).
> Here the example:
>
> DATA LIST LIST /v1(F8) v2(F8) v3(F8).
> BEGIN DATA.
> 2 4 90
> 4 4 7
> 3 5 7
> END DATA.
>
> compute meanvar_1=mean(v1 to v3).
> compute break = 1.
>
> AGGREGATE
> /OUTFILE=*
> MODE=ADDVARIABLES
> /BREAK=break
> /meanvar = MEAN(meanvar_1).
>
> * Write a template for the reference line.
> * The template is saved as: d:\temp\ReferenceLine.sgt.
> * The mean is written as meanvar (from the variabel meanvar) into the
> template.
> * The line style is set to red here.
>
> Do if $casenum = 1.
> WRITE OUTFILE='d:\temp\ReferenceLine.sgt'
> /'<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
> /'<template SPSS-Version="2.2" '
> /' selectPath="900 " '
> /' xmlns="http://xml.spss.com/spss/visualization" '
> /' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
> /' xsi:schemaLocation="http://xml.spss.com/spss/visualization '
> /' http://xml.spss.com/spss/visualization/vizml-template-3.0.xsd">'
> /' <addReferenceLine styleOnly="false" y=" '
> /meanvar
> /' " ycategorical="false">'
> /' <style color="#f50000" visible="true"/>'
> /' </addReferenceLine>'
> /'</template>'.
> End if.
> EXECUTE.
>
> GGRAPH
> /GRAPHDATASET NAME="graphdataset" VARIABLES=v1 to v3
> MISSING=LISTWISE REPORTMISSING=NO
> /GRAPHSPEC SOURCE=INLINE
> TEMPLATE=[
> "D:\Temp\ReferenceLine.sgt"].
> BEGIN GPL
> SOURCE: s=userSource(id("graphdataset"))
> DATA: v1=col(source(s), name("v1"))
> DATA: v2=col(source(s), name("v2"))
> DATA: v3=col(source(s), name("v3"))
> ELEMENT: interval(position(region.confi.mean( "v1" * v1 )),
> shape.interior(shape.ibeam) )
> ELEMENT: interval(position(region.confi.mean( "v2" * v2 )),
> shape.interior(shape.ibeam) )
> ELEMENT: interval(position(region.confi.mean( "v3" * v3 )),
> shape.interior(shape.ibeam) )
> ELEMENT: point(position(summary.mean( "v1" * v1 )),
> color.interior(color.red) )
> ELEMENT: point(position(summary.mean( "v2" * v2 )),
> color.interior(color.red) )
> ELEMENT: point(position(summary.mean( "v3" * v3 )),
> color.interior(color.red) )
> END GPL.
>
> Hope this helps
> Christian
>
>
|