Issue with GGRAPH template

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

Issue with GGRAPH template

Luca Meyer-3
Hi,

I am trying to show group-specific percentages within pie graphs and I
actually succeed to show them.

So I run the following syntax:

GGRAPH
   /GRAPHDATASET NAME="graphdataset" VARIABLES=CLUSTER D24 COUNT()
[name="COUNT"] MISSING=LISTWISE
     REPORTMISSING=NO
   /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
   SOURCE: s=userSource(id("graphdataset"))
   DATA: CLUSTER=col(source(s), name("CLUSTER"), unit.category())
   DATA: D24=col(source(s), name("D24"), unit.category())
   DATA: COUNT=col(source(s), name("COUNT"))
   COORD: polar.theta(startAngle(0))
   GUIDE: axis(dim(1), null())
   GUIDE: axis(dim(2), label("CLUSTER"), opposite())
   GUIDE: legend(aesthetic(aesthetic.color.interior), label("title"))
   SCALE: linear(dim(1), dataMinimum(), dataMaximum())
   SCALE: cat(dim(2), include("1.00", "2.00", "3.00", "4.00"))
   ELEMENT:
interval.stack(position(summary.percent(summary.percent(COUNT*CLUSTER,
base.all(acrossPanels())))), color.interior(D24))
END GPL.

And I have something like

FIRST PIE - CATEGORY A - 30 CASES - 60%
FIRST PIE - CATEGORY B - 20 CASES - 40%
SECOND PIE - CATEGORY A - 20 CASES - 40%
SECOND PIE - CATEGORY B - 30 CASES - 60%

And this is actually what I need to show.

Now I need to apply the same template to several dozens of variables
each month, so I am creating a template (file *.sgt) which contains
what follows:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<template SPSS-Version="2.5" date="2009-06-07" description=""
selectPath="87 2 3 30 10 72 73 74 75 76 93 90 92 12 13 17 18 25 "
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.1.xsd
">
        <setPieTranspose counterClockwise="false" startAngle="90"/>
        <setPanelOptions gap="2%" role="x"/>
        <setWrapPanels wrap="false"/>
        <addFrame count="1" type="visualization">
                <location bottom="502px" left="0px" right="627px" top="0px"/>
                <style color="#ffffff" color2="transparent" number="0"
visible="true"/>
                <style font-family="SansSerif" font-size="8pt" number="1"
pattern="0" stroke-linecap="butt" text-fit="true" visible="true"/>
        </addFrame>
        <addFrame count="1" type="graph">
                <location bottom="97.5%" left="2%" right="75%" top="2.5%"/>
                <style color="transparent" color2="transparent" visible="true"/>
                <style color="transparent" color2="transparent" number="2"
visible="true"/>
        </addFrame>
        <addFrame count="1" type="container">
                <location bottom="41%" left="75%" right="98%" top="3%"/>
        </addFrame>
        <setTranspose transpose="false"/>
        <addDataLabels colorByMarker="false" hidden="false"
showCollidingLabels="false">
                <style color="#000000" font-size="8pt" font-style="regular" font-
weight="regular" number="0" visible="visible"/>
                <style color="#ffffff" color2="#000000" number="1" visible="true"/>
                <labeling variable="percent"/>
                <labeling variable="percent">
                        <format maximumFractionDigits="2" minimumFractionDigits="2"
suffix="%" useGrouping="true"/>
                </labeling>
        </addDataLabels>
        <addFrame count="1" type="legend">
                <style color="transparent" color2="transparent" visible="true"/>
                <style color="#000000" color2="transparent" font-size="8pt" font-
weight="regular" number="1" visible="true"/>
                <style color="transparent" color2="transparent" number="0"
visible="true"/>
                <label><style color="#000000" color2="transparent" font-size="10pt"
font-weight="regular" number="0" visible="true"/></label>
        </addFrame>
        <setStyle type="pie">
                <style color2="#000000" fill-opacity="1.0" opacity="1.0" stroke-
linecap="round" visible="true"/>
        </setStyle>
        <setStyle type="pie">
                <style color2="#000000" fill-opacity="1.0" opacity="1.0" stroke-
linecap="round" visible="true"/>
        </setStyle>
        <setStyle subtype="simple" type="pie">
                <style color2="#000000" fill-opacity="1.0" opacity="1.0" stroke-
linecap="round" visible="true"/>
        </setStyle>
        <setStyle>
                <style color="#000000" color2="#ffffff" font-size="8pt"
visible="true"/>
        </setStyle>
        <setColor aestheticNumber="1">
                <cycle>
                        <style color="#3e58ac" visible="true"/>
                        <style color="#2eb848" visible="true"/>
                        <style color="#d3ce97" visible="true"/>
                        <style color="#7c287d" visible="true"/>
                        <style color="#fbf873" visible="true"/>
                        <style color="#ef3338" visible="true"/>
                        <style color="#48c2c5" visible="true"/>
                        <style color="#cccccc" visible="true"/>
                        <style color="#7aaad5" visible="true"/>
                        <style color="#0a562c" visible="true"/>
                        <style color="#f8981d" visible="true"/>
                        <style color="#ddbaf1" visible="true"/>
                        <style color="#1a5f76" visible="true"/>
                        <style color="#ccffcc" visible="true"/>
                        <style color="#bb3f7f" visible="true"/>
                        <style color="#999999" visible="true"/>
                        <style color="#000000" visible="true"/>
                        <style color="#b6e7e8" visible="true"/>
                        <style color="#ffffff" visible="true"/>
                        <style color="#797aa7" visible="true"/>
                        <style color="#70dc84" visible="true"/>
                        <style color="#333333" visible="true"/>
                        <style color="#acd0ee" visible="true"/>
                        <style color="#a21619" visible="true"/>
                        <style color="#5d61ff" visible="true"/>
                        <style color="#e4e4e4" visible="true"/>
                        <style color="#248bac" visible="true"/>
                        <style color="#b89bc9" visible="true"/>
                        <style color="#666666" visible="true"/>
                        <style color="#0d8d46" visible="true"/>
                </cycle>
        </setColor>
</template>

The issue is that when I apply this template with the same syntax:

GGRAPH
   /GRAPHDATASET NAME="graphdataset" VARIABLES=CLUSTER D24 COUNT()
[name="COUNT"] MISSING=LISTWISE
     REPORTMISSING=NO
   /GRAPHSPEC SOURCE=INLINE TEMPLATE=["/Users/luca/Desktop/test.sgt"].
BEGIN GPL
   SOURCE: s=userSource(id("graphdataset"))
   DATA: CLUSTER=col(source(s), name("CLUSTER"), unit.category())
   DATA: D24=col(source(s), name("D24"), unit.category())
   DATA: COUNT=col(source(s), name("COUNT"))
   COORD: polar.theta(startAngle(0))
   GUIDE: axis(dim(1), null())
   GUIDE: axis(dim(2), label("CLUSTER"), opposite())
   GUIDE: legend(aesthetic(aesthetic.color.interior), label("title"))
   SCALE: linear(dim(1), dataMinimum(), dataMaximum())
   SCALE: cat(dim(2), include("1.00", "2.00", "3.00", "4.00"))
   ELEMENT:
interval.stack(position(summary.percent(summary.percent(COUNT*CLUSTER,
base.all(acrossPanels())))), color.interior(D24))
END GPL.

I get the following result:

FIRST PIE - CATEGORY A - 30 CASES - 30%
FIRST PIE - CATEGORY B - 20 CASES - 20%
SECOND PIE - CATEGORY A - 20 CASES - 20%
SECOND PIE - CATEGORY B - 30 CASES - 30%

That is, now my percentage does not refer any longer to each cluster
but to the entire dataset.

How can I correct that? I have tried to remove "acrossPanels()" on the
line before the last but nothing has changed, I suspected was
something that has to do with the *.sgt file so I have tried to set
useGrouping="false" in the addDataLabels part of the code but nothing
has changed....

BTW: I am using SPSS 17.0.2 for MAC.

Thank you in advance for any advise you might be able to provide.

Luca


Mr. Luca Meyer
www.lucameyer.com

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Issue with GGRAPH template

ViAnn Beadle
What kinds of edits to the chart are you trying to save into a template file
and what check boxes did you check when you saved the template from the SPSS
editor? Less is more when it comes to creating templates ;-)

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Luca Meyer
Sent: Sunday, June 07, 2009 1:09 AM
To: [hidden email]
Subject: Issue with GGRAPH template

Hi,

I am trying to show group-specific percentages within pie graphs and I
actually succeed to show them.

So I run the following syntax:

GGRAPH
   /GRAPHDATASET NAME="graphdataset" VARIABLES=CLUSTER D24 COUNT()
[name="COUNT"] MISSING=LISTWISE
     REPORTMISSING=NO
   /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
   SOURCE: s=userSource(id("graphdataset"))
   DATA: CLUSTER=col(source(s), name("CLUSTER"), unit.category())
   DATA: D24=col(source(s), name("D24"), unit.category())
   DATA: COUNT=col(source(s), name("COUNT"))
   COORD: polar.theta(startAngle(0))
   GUIDE: axis(dim(1), null())
   GUIDE: axis(dim(2), label("CLUSTER"), opposite())
   GUIDE: legend(aesthetic(aesthetic.color.interior), label("title"))
   SCALE: linear(dim(1), dataMinimum(), dataMaximum())
   SCALE: cat(dim(2), include("1.00", "2.00", "3.00", "4.00"))
   ELEMENT:
interval.stack(position(summary.percent(summary.percent(COUNT*CLUSTER,
base.all(acrossPanels())))), color.interior(D24))
END GPL.

And I have something like

FIRST PIE - CATEGORY A - 30 CASES - 60%
FIRST PIE - CATEGORY B - 20 CASES - 40%
SECOND PIE - CATEGORY A - 20 CASES - 40%
SECOND PIE - CATEGORY B - 30 CASES - 60%

And this is actually what I need to show.

Now I need to apply the same template to several dozens of variables
each month, so I am creating a template (file *.sgt) which contains
what follows:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<template SPSS-Version="2.5" date="2009-06-07" description=""
selectPath="87 2 3 30 10 72 73 74 75 76 93 90 92 12 13 17 18 25 "
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.1.xsd
">
        <setPieTranspose counterClockwise="false" startAngle="90"/>
        <setPanelOptions gap="2%" role="x"/>
        <setWrapPanels wrap="false"/>
        <addFrame count="1" type="visualization">
                <location bottom="502px" left="0px" right="627px"
top="0px"/>
                <style color="#ffffff" color2="transparent" number="0"
visible="true"/>
                <style font-family="SansSerif" font-size="8pt" number="1"
pattern="0" stroke-linecap="butt" text-fit="true" visible="true"/>
        </addFrame>
        <addFrame count="1" type="graph">
                <location bottom="97.5%" left="2%" right="75%" top="2.5%"/>
                <style color="transparent" color2="transparent"
visible="true"/>
                <style color="transparent" color2="transparent" number="2"
visible="true"/>
        </addFrame>
        <addFrame count="1" type="container">
                <location bottom="41%" left="75%" right="98%" top="3%"/>
        </addFrame>
        <setTranspose transpose="false"/>
        <addDataLabels colorByMarker="false" hidden="false"
showCollidingLabels="false">
                <style color="#000000" font-size="8pt" font-style="regular"
font-
weight="regular" number="0" visible="visible"/>
                <style color="#ffffff" color2="#000000" number="1"
visible="true"/>
                <labeling variable="percent"/>
                <labeling variable="percent">
                        <format maximumFractionDigits="2"
minimumFractionDigits="2"
suffix="%" useGrouping="true"/>
                </labeling>
        </addDataLabels>
        <addFrame count="1" type="legend">
                <style color="transparent" color2="transparent"
visible="true"/>
                <style color="#000000" color2="transparent" font-size="8pt"
font-
weight="regular" number="1" visible="true"/>
                <style color="transparent" color2="transparent" number="0"
visible="true"/>
                <label><style color="#000000" color2="transparent"
font-size="10pt"
font-weight="regular" number="0" visible="true"/></label>
        </addFrame>
        <setStyle type="pie">
                <style color2="#000000" fill-opacity="1.0" opacity="1.0"
stroke-
linecap="round" visible="true"/>
        </setStyle>
        <setStyle type="pie">
                <style color2="#000000" fill-opacity="1.0" opacity="1.0"
stroke-
linecap="round" visible="true"/>
        </setStyle>
        <setStyle subtype="simple" type="pie">
                <style color2="#000000" fill-opacity="1.0" opacity="1.0"
stroke-
linecap="round" visible="true"/>
        </setStyle>
        <setStyle>
                <style color="#000000" color2="#ffffff" font-size="8pt"
visible="true"/>
        </setStyle>
        <setColor aestheticNumber="1">
                <cycle>
                        <style color="#3e58ac" visible="true"/>
                        <style color="#2eb848" visible="true"/>
                        <style color="#d3ce97" visible="true"/>
                        <style color="#7c287d" visible="true"/>
                        <style color="#fbf873" visible="true"/>
                        <style color="#ef3338" visible="true"/>
                        <style color="#48c2c5" visible="true"/>
                        <style color="#cccccc" visible="true"/>
                        <style color="#7aaad5" visible="true"/>
                        <style color="#0a562c" visible="true"/>
                        <style color="#f8981d" visible="true"/>
                        <style color="#ddbaf1" visible="true"/>
                        <style color="#1a5f76" visible="true"/>
                        <style color="#ccffcc" visible="true"/>
                        <style color="#bb3f7f" visible="true"/>
                        <style color="#999999" visible="true"/>
                        <style color="#000000" visible="true"/>
                        <style color="#b6e7e8" visible="true"/>
                        <style color="#ffffff" visible="true"/>
                        <style color="#797aa7" visible="true"/>
                        <style color="#70dc84" visible="true"/>
                        <style color="#333333" visible="true"/>
                        <style color="#acd0ee" visible="true"/>
                        <style color="#a21619" visible="true"/>
                        <style color="#5d61ff" visible="true"/>
                        <style color="#e4e4e4" visible="true"/>
                        <style color="#248bac" visible="true"/>
                        <style color="#b89bc9" visible="true"/>
                        <style color="#666666" visible="true"/>
                        <style color="#0d8d46" visible="true"/>
                </cycle>
        </setColor>
</template>

The issue is that when I apply this template with the same syntax:

GGRAPH
   /GRAPHDATASET NAME="graphdataset" VARIABLES=CLUSTER D24 COUNT()
[name="COUNT"] MISSING=LISTWISE
     REPORTMISSING=NO
   /GRAPHSPEC SOURCE=INLINE TEMPLATE=["/Users/luca/Desktop/test.sgt"].
BEGIN GPL
   SOURCE: s=userSource(id("graphdataset"))
   DATA: CLUSTER=col(source(s), name("CLUSTER"), unit.category())
   DATA: D24=col(source(s), name("D24"), unit.category())
   DATA: COUNT=col(source(s), name("COUNT"))
   COORD: polar.theta(startAngle(0))
   GUIDE: axis(dim(1), null())
   GUIDE: axis(dim(2), label("CLUSTER"), opposite())
   GUIDE: legend(aesthetic(aesthetic.color.interior), label("title"))
   SCALE: linear(dim(1), dataMinimum(), dataMaximum())
   SCALE: cat(dim(2), include("1.00", "2.00", "3.00", "4.00"))
   ELEMENT:
interval.stack(position(summary.percent(summary.percent(COUNT*CLUSTER,
base.all(acrossPanels())))), color.interior(D24))
END GPL.

I get the following result:

FIRST PIE - CATEGORY A - 30 CASES - 30%
FIRST PIE - CATEGORY B - 20 CASES - 20%
SECOND PIE - CATEGORY A - 20 CASES - 20%
SECOND PIE - CATEGORY B - 30 CASES - 30%

That is, now my percentage does not refer any longer to each cluster
but to the entire dataset.

How can I correct that? I have tried to remove "acrossPanels()" on the
line before the last but nothing has changed, I suspected was
something that has to do with the *.sgt file so I have tried to set
useGrouping="false" in the addDataLabels part of the code but nothing
has changed....

BTW: I am using SPSS 17.0.2 for MAC.

Thank you in advance for any advise you might be able to provide.

Luca


Mr. Luca Meyer
www.lucameyer.com

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Issue with GGRAPH template

Luca Meyer-3
I have tried to simplify the edits I am saving but actually I cannot
get passed the issue of having incorrect percentages showing. More
specifically, when I manualy insert the chart labels I get the correct
figures showing but when I rerun the syntax the percentage does not
refer any longer to the single pie but to the entire dataset.

Luca

Il giorno 07/giu/09, alle ore 17:29, ViAnn Beadle ha scritto:

> What kinds of edits to the chart are you trying to save into a
> template file
> and what check boxes did you check when you saved the template from
> the SPSS
> editor? Less is more when it comes to creating templates ;-)
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On
> Behalf Of
> Luca Meyer
> Sent: Sunday, June 07, 2009 1:09 AM
> To: [hidden email]
> Subject: Issue with GGRAPH template
>
> Hi,
>
> I am trying to show group-specific percentages within pie graphs and I
> actually succeed to show them.
>
> So I run the following syntax:
>
> GGRAPH
>   /GRAPHDATASET NAME="graphdataset" VARIABLES=CLUSTER D24 COUNT()
> [name="COUNT"] MISSING=LISTWISE
>     REPORTMISSING=NO
>   /GRAPHSPEC SOURCE=INLINE.
> BEGIN GPL
>   SOURCE: s=userSource(id("graphdataset"))
>   DATA: CLUSTER=col(source(s), name("CLUSTER"), unit.category())
>   DATA: D24=col(source(s), name("D24"), unit.category())
>   DATA: COUNT=col(source(s), name("COUNT"))
>   COORD: polar.theta(startAngle(0))
>   GUIDE: axis(dim(1), null())
>   GUIDE: axis(dim(2), label("CLUSTER"), opposite())
>   GUIDE: legend(aesthetic(aesthetic.color.interior), label("title"))
>   SCALE: linear(dim(1), dataMinimum(), dataMaximum())
>   SCALE: cat(dim(2), include("1.00", "2.00", "3.00", "4.00"))
>   ELEMENT:
> interval.stack(position(summary.percent(summary.percent(COUNT*CLUSTER,
> base.all(acrossPanels())))), color.interior(D24))
> END GPL.
>
> And I have something like
>
> FIRST PIE - CATEGORY A - 30 CASES - 60%
> FIRST PIE - CATEGORY B - 20 CASES - 40%
> SECOND PIE - CATEGORY A - 20 CASES - 40%
> SECOND PIE - CATEGORY B - 30 CASES - 60%
>
> And this is actually what I need to show.
>
> Now I need to apply the same template to several dozens of variables
> each month, so I am creating a template (file *.sgt) which contains
> what follows:
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <template SPSS-Version="2.5" date="2009-06-07" description=""
> selectPath="87 2 3 30 10 72 73 74 75 76 93 90 92 12 13 17 18 25 "
> 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.1.xsd
> ">
>        <setPieTranspose counterClockwise="false" startAngle="90"/>
>        <setPanelOptions gap="2%" role="x"/>
>        <setWrapPanels wrap="false"/>
>        <addFrame count="1" type="visualization">
>                <location bottom="502px" left="0px" right="627px"
> top="0px"/>
>                <style color="#ffffff" color2="transparent" number="0"
> visible="true"/>
>                <style font-family="SansSerif" font-size="8pt"
> number="1"
> pattern="0" stroke-linecap="butt" text-fit="true" visible="true"/>
>        </addFrame>
>        <addFrame count="1" type="graph">
>                <location bottom="97.5%" left="2%" right="75%"
> top="2.5%"/>
>                <style color="transparent" color2="transparent"
> visible="true"/>
>                <style color="transparent" color2="transparent"
> number="2"
> visible="true"/>
>        </addFrame>
>        <addFrame count="1" type="container">
>                <location bottom="41%" left="75%" right="98%"
> top="3%"/>
>        </addFrame>
>        <setTranspose transpose="false"/>
>        <addDataLabels colorByMarker="false" hidden="false"
> showCollidingLabels="false">
>                <style color="#000000" font-size="8pt" font-
> style="regular"
> font-
> weight="regular" number="0" visible="visible"/>
>                <style color="#ffffff" color2="#000000" number="1"
> visible="true"/>
>                <labeling variable="percent"/>
>                <labeling variable="percent">
>                        <format maximumFractionDigits="2"
> minimumFractionDigits="2"
> suffix="%" useGrouping="true"/>
>                </labeling>
>        </addDataLabels>
>        <addFrame count="1" type="legend">
>                <style color="transparent" color2="transparent"
> visible="true"/>
>                <style color="#000000" color2="transparent" font-
> size="8pt"
> font-
> weight="regular" number="1" visible="true"/>
>                <style color="transparent" color2="transparent"
> number="0"
> visible="true"/>
>                <label><style color="#000000" color2="transparent"
> font-size="10pt"
> font-weight="regular" number="0" visible="true"/></label>
>        </addFrame>
>        <setStyle type="pie">
>                <style color2="#000000" fill-opacity="1.0"
> opacity="1.0"
> stroke-
> linecap="round" visible="true"/>
>        </setStyle>
>        <setStyle type="pie">
>                <style color2="#000000" fill-opacity="1.0"
> opacity="1.0"
> stroke-
> linecap="round" visible="true"/>
>        </setStyle>
>        <setStyle subtype="simple" type="pie">
>                <style color2="#000000" fill-opacity="1.0"
> opacity="1.0"
> stroke-
> linecap="round" visible="true"/>
>        </setStyle>
>        <setStyle>
>                <style color="#000000" color2="#ffffff" font-size="8pt"
> visible="true"/>
>        </setStyle>
>        <setColor aestheticNumber="1">
>                <cycle>
>                        <style color="#3e58ac" visible="true"/>
>                        <style color="#2eb848" visible="true"/>
>                        <style color="#d3ce97" visible="true"/>
>                        <style color="#7c287d" visible="true"/>
>                        <style color="#fbf873" visible="true"/>
>                        <style color="#ef3338" visible="true"/>
>                        <style color="#48c2c5" visible="true"/>
>                        <style color="#cccccc" visible="true"/>
>                        <style color="#7aaad5" visible="true"/>
>                        <style color="#0a562c" visible="true"/>
>                        <style color="#f8981d" visible="true"/>
>                        <style color="#ddbaf1" visible="true"/>
>                        <style color="#1a5f76" visible="true"/>
>                        <style color="#ccffcc" visible="true"/>
>                        <style color="#bb3f7f" visible="true"/>
>                        <style color="#999999" visible="true"/>
>                        <style color="#000000" visible="true"/>
>                        <style color="#b6e7e8" visible="true"/>
>                        <style color="#ffffff" visible="true"/>
>                        <style color="#797aa7" visible="true"/>
>                        <style color="#70dc84" visible="true"/>
>                        <style color="#333333" visible="true"/>
>                        <style color="#acd0ee" visible="true"/>
>                        <style color="#a21619" visible="true"/>
>                        <style color="#5d61ff" visible="true"/>
>                        <style color="#e4e4e4" visible="true"/>
>                        <style color="#248bac" visible="true"/>
>                        <style color="#b89bc9" visible="true"/>
>                        <style color="#666666" visible="true"/>
>                        <style color="#0d8d46" visible="true"/>
>                </cycle>
>        </setColor>
> </template>
>
> The issue is that when I apply this template with the same syntax:
>
> GGRAPH
>   /GRAPHDATASET NAME="graphdataset" VARIABLES=CLUSTER D24 COUNT()
> [name="COUNT"] MISSING=LISTWISE
>     REPORTMISSING=NO
>   /GRAPHSPEC SOURCE=INLINE TEMPLATE=["/Users/luca/Desktop/test.sgt"].
> BEGIN GPL
>   SOURCE: s=userSource(id("graphdataset"))
>   DATA: CLUSTER=col(source(s), name("CLUSTER"), unit.category())
>   DATA: D24=col(source(s), name("D24"), unit.category())
>   DATA: COUNT=col(source(s), name("COUNT"))
>   COORD: polar.theta(startAngle(0))
>   GUIDE: axis(dim(1), null())
>   GUIDE: axis(dim(2), label("CLUSTER"), opposite())
>   GUIDE: legend(aesthetic(aesthetic.color.interior), label("title"))
>   SCALE: linear(dim(1), dataMinimum(), dataMaximum())
>   SCALE: cat(dim(2), include("1.00", "2.00", "3.00", "4.00"))
>   ELEMENT:
> interval.stack(position(summary.percent(summary.percent(COUNT*CLUSTER,
> base.all(acrossPanels())))), color.interior(D24))
> END GPL.
>
> I get the following result:
>
> FIRST PIE - CATEGORY A - 30 CASES - 30%
> FIRST PIE - CATEGORY B - 20 CASES - 20%
> SECOND PIE - CATEGORY A - 20 CASES - 20%
> SECOND PIE - CATEGORY B - 30 CASES - 30%
>
> That is, now my percentage does not refer any longer to each cluster
> but to the entire dataset.
>
> How can I correct that? I have tried to remove "acrossPanels()" on the
> line before the last but nothing has changed, I suspected was
> something that has to do with the *.sgt file so I have tried to set
> useGrouping="false" in the addDataLabels part of the code but nothing
> has changed....
>
> BTW: I am using SPSS 17.0.2 for MAC.
>
> Thank you in advance for any advise you might be able to provide.
>
> Luca
>
>
> Mr. Luca Meyer
> www.lucameyer.com
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except
> the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Issue with GGRAPH template

ViAnn Beadle
You don't need to add the labels in the editor, you can create them by using
the label function on your ELEMENT command. Add this to your element
statement--does it do what you want?

label(summary.percent(COUNT*CLUSTER))

-----Original Message-----
From: Luca Meyer [mailto:[hidden email]]
Sent: Monday, June 08, 2009 12:19 AM
To: SPSSX-L
Cc: ViAnn Beadle
Subject: Re: Issue with GGRAPH template

I have tried to simplify the edits I am saving but actually I cannot
get passed the issue of having incorrect percentages showing. More
specifically, when I manualy insert the chart labels I get the correct
figures showing but when I rerun the syntax the percentage does not
refer any longer to the single pie but to the entire dataset.

Luca

Il giorno 07/giu/09, alle ore 17:29, ViAnn Beadle ha scritto:

> What kinds of edits to the chart are you trying to save into a
> template file
> and what check boxes did you check when you saved the template from
> the SPSS
> editor? Less is more when it comes to creating templates ;-)
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On
> Behalf Of
> Luca Meyer
> Sent: Sunday, June 07, 2009 1:09 AM
> To: [hidden email]
> Subject: Issue with GGRAPH template
>
> Hi,
>
> I am trying to show group-specific percentages within pie graphs and I
> actually succeed to show them.
>
> So I run the following syntax:
>
> GGRAPH
>   /GRAPHDATASET NAME="graphdataset" VARIABLES=CLUSTER D24 COUNT()
> [name="COUNT"] MISSING=LISTWISE
>     REPORTMISSING=NO
>   /GRAPHSPEC SOURCE=INLINE.
> BEGIN GPL
>   SOURCE: s=userSource(id("graphdataset"))
>   DATA: CLUSTER=col(source(s), name("CLUSTER"), unit.category())
>   DATA: D24=col(source(s), name("D24"), unit.category())
>   DATA: COUNT=col(source(s), name("COUNT"))
>   COORD: polar.theta(startAngle(0))
>   GUIDE: axis(dim(1), null())
>   GUIDE: axis(dim(2), label("CLUSTER"), opposite())
>   GUIDE: legend(aesthetic(aesthetic.color.interior), label("title"))
>   SCALE: linear(dim(1), dataMinimum(), dataMaximum())
>   SCALE: cat(dim(2), include("1.00", "2.00", "3.00", "4.00"))
>   ELEMENT:
> interval.stack(position(summary.percent(summary.percent(COUNT*CLUSTER,
> base.all(acrossPanels())))), color.interior(D24))
> END GPL.
>
> And I have something like
>
> FIRST PIE - CATEGORY A - 30 CASES - 60%
> FIRST PIE - CATEGORY B - 20 CASES - 40%
> SECOND PIE - CATEGORY A - 20 CASES - 40%
> SECOND PIE - CATEGORY B - 30 CASES - 60%
>
> And this is actually what I need to show.
>
> Now I need to apply the same template to several dozens of variables
> each month, so I am creating a template (file *.sgt) which contains
> what follows:
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <template SPSS-Version="2.5" date="2009-06-07" description=""
> selectPath="87 2 3 30 10 72 73 74 75 76 93 90 92 12 13 17 18 25 "
> 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.1.xsd
> ">
>        <setPieTranspose counterClockwise="false" startAngle="90"/>
>        <setPanelOptions gap="2%" role="x"/>
>        <setWrapPanels wrap="false"/>
>        <addFrame count="1" type="visualization">
>                <location bottom="502px" left="0px" right="627px"
> top="0px"/>
>                <style color="#ffffff" color2="transparent" number="0"
> visible="true"/>
>                <style font-family="SansSerif" font-size="8pt"
> number="1"
> pattern="0" stroke-linecap="butt" text-fit="true" visible="true"/>
>        </addFrame>
>        <addFrame count="1" type="graph">
>                <location bottom="97.5%" left="2%" right="75%"
> top="2.5%"/>
>                <style color="transparent" color2="transparent"
> visible="true"/>
>                <style color="transparent" color2="transparent"
> number="2"
> visible="true"/>
>        </addFrame>
>        <addFrame count="1" type="container">
>                <location bottom="41%" left="75%" right="98%"
> top="3%"/>
>        </addFrame>
>        <setTranspose transpose="false"/>
>        <addDataLabels colorByMarker="false" hidden="false"
> showCollidingLabels="false">
>                <style color="#000000" font-size="8pt" font-
> style="regular"
> font-
> weight="regular" number="0" visible="visible"/>
>                <style color="#ffffff" color2="#000000" number="1"
> visible="true"/>
>                <labeling variable="percent"/>
>                <labeling variable="percent">
>                        <format maximumFractionDigits="2"
> minimumFractionDigits="2"
> suffix="%" useGrouping="true"/>
>                </labeling>
>        </addDataLabels>
>        <addFrame count="1" type="legend">
>                <style color="transparent" color2="transparent"
> visible="true"/>
>                <style color="#000000" color2="transparent" font-
> size="8pt"
> font-
> weight="regular" number="1" visible="true"/>
>                <style color="transparent" color2="transparent"
> number="0"
> visible="true"/>
>                <label><style color="#000000" color2="transparent"
> font-size="10pt"
> font-weight="regular" number="0" visible="true"/></label>
>        </addFrame>
>        <setStyle type="pie">
>                <style color2="#000000" fill-opacity="1.0"
> opacity="1.0"
> stroke-
> linecap="round" visible="true"/>
>        </setStyle>
>        <setStyle type="pie">
>                <style color2="#000000" fill-opacity="1.0"
> opacity="1.0"
> stroke-
> linecap="round" visible="true"/>
>        </setStyle>
>        <setStyle subtype="simple" type="pie">
>                <style color2="#000000" fill-opacity="1.0"
> opacity="1.0"
> stroke-
> linecap="round" visible="true"/>
>        </setStyle>
>        <setStyle>
>                <style color="#000000" color2="#ffffff" font-size="8pt"
> visible="true"/>
>        </setStyle>
>        <setColor aestheticNumber="1">
>                <cycle>
>                        <style color="#3e58ac" visible="true"/>
>                        <style color="#2eb848" visible="true"/>
>                        <style color="#d3ce97" visible="true"/>
>                        <style color="#7c287d" visible="true"/>
>                        <style color="#fbf873" visible="true"/>
>                        <style color="#ef3338" visible="true"/>
>                        <style color="#48c2c5" visible="true"/>
>                        <style color="#cccccc" visible="true"/>
>                        <style color="#7aaad5" visible="true"/>
>                        <style color="#0a562c" visible="true"/>
>                        <style color="#f8981d" visible="true"/>
>                        <style color="#ddbaf1" visible="true"/>
>                        <style color="#1a5f76" visible="true"/>
>                        <style color="#ccffcc" visible="true"/>
>                        <style color="#bb3f7f" visible="true"/>
>                        <style color="#999999" visible="true"/>
>                        <style color="#000000" visible="true"/>
>                        <style color="#b6e7e8" visible="true"/>
>                        <style color="#ffffff" visible="true"/>
>                        <style color="#797aa7" visible="true"/>
>                        <style color="#70dc84" visible="true"/>
>                        <style color="#333333" visible="true"/>
>                        <style color="#acd0ee" visible="true"/>
>                        <style color="#a21619" visible="true"/>
>                        <style color="#5d61ff" visible="true"/>
>                        <style color="#e4e4e4" visible="true"/>
>                        <style color="#248bac" visible="true"/>
>                        <style color="#b89bc9" visible="true"/>
>                        <style color="#666666" visible="true"/>
>                        <style color="#0d8d46" visible="true"/>
>                </cycle>
>        </setColor>
> </template>
>
> The issue is that when I apply this template with the same syntax:
>
> GGRAPH
>   /GRAPHDATASET NAME="graphdataset" VARIABLES=CLUSTER D24 COUNT()
> [name="COUNT"] MISSING=LISTWISE
>     REPORTMISSING=NO
>   /GRAPHSPEC SOURCE=INLINE TEMPLATE=["/Users/luca/Desktop/test.sgt"].
> BEGIN GPL
>   SOURCE: s=userSource(id("graphdataset"))
>   DATA: CLUSTER=col(source(s), name("CLUSTER"), unit.category())
>   DATA: D24=col(source(s), name("D24"), unit.category())
>   DATA: COUNT=col(source(s), name("COUNT"))
>   COORD: polar.theta(startAngle(0))
>   GUIDE: axis(dim(1), null())
>   GUIDE: axis(dim(2), label("CLUSTER"), opposite())
>   GUIDE: legend(aesthetic(aesthetic.color.interior), label("title"))
>   SCALE: linear(dim(1), dataMinimum(), dataMaximum())
>   SCALE: cat(dim(2), include("1.00", "2.00", "3.00", "4.00"))
>   ELEMENT:
> interval.stack(position(summary.percent(summary.percent(COUNT*CLUSTER,
> base.all(acrossPanels())))), color.interior(D24))
> END GPL.
>
> I get the following result:
>
> FIRST PIE - CATEGORY A - 30 CASES - 30%
> FIRST PIE - CATEGORY B - 20 CASES - 20%
> SECOND PIE - CATEGORY A - 20 CASES - 20%
> SECOND PIE - CATEGORY B - 30 CASES - 30%
>
> That is, now my percentage does not refer any longer to each cluster
> but to the entire dataset.
>
> How can I correct that? I have tried to remove "acrossPanels()" on the
> line before the last but nothing has changed, I suspected was
> something that has to do with the *.sgt file so I have tried to set
> useGrouping="false" in the addDataLabels part of the code but nothing
> has changed....
>
> BTW: I am using SPSS 17.0.2 for MAC.
>
> Thank you in advance for any advise you might be able to provide.
>
> Luca
>
>
> Mr. Luca Meyer
> www.lucameyer.com
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except
> the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD