Two GPL questions

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

Two GPL questions

Kirill Orlov
I'm using version 20. How can I do it in GPL:

  • Manipulate characterics of greedlines (such as line type, line weight) only, without touching the axis line itself? I could not find anything about it in the GPL reference guide.
  • Manipulate label position of point elements (such as 9 o'clock, 12 o'clock..)?

Thank you if you can help.

Reply | Threaded
Open this post in threaded view
|

Re: Two GPL questions

Andy W
I have details on how to do the gridlines in my blog post, Hacking the default SPSS chart template. You can not control either directly in GPL - you either have to post-hoc edit the chart or save a particular template (and apply it to charts later on) to control those parts of the chart.

For gridlines the xml I have in my blog post looks like this:

<gridLines>
  <style color="#cccccc" stroke-dasharray="3px,6px" stroke-width="0.5pt" visible="true"/>
</gridLines>

You can probably figure out how the xml options work. This xml is then nested within a tag, <setAxisMajorTicks>, although I am guessing there is an equivalent for minor ticks as well. Also note for another complication that the <setAxisMajorTicks> can apply to either the x or y axis, and it can apply to categorical or continuous scales.

I haven't played around with data labels much. What I do to check these things is to make a quick chart and then save the chart template. Here I added value labels and then edited the position of the labels through the chart editor. Here is what I found:

        <addDataLabels colorByMarker="false" hidden="false" labelLocationHorizontal="negative" labelLocationVertical="center">
                <style color="#000000" font-size="8pt" font-style="regular" font-weight="regular" number="0" padding="2px" stroke-width="0.5pt" visible="visible"/>
                <style color="transparent" color2="transparent" coordinate="1" number="1" visible="true"/>
                <labeling variable="legend1"/>
        </addDataLabels>

So to control the location of the label the <addDataLabels> tag contains parameters labelLocationHorizontal and labelLocationVertical. These correspond to the grid options you have in the chart editor (I'm guessing positive is the other option to get the labels to the right). Cartography has pretty much come to agreement on that above and to the right is the slightly preferential location for the label (which is the default in SPSS charts) and top and to the left the second choice. But most of the time overplotting is the bigger evil when placing labels, so they just go where convenient.

I'm not 100% sure about the other data value parameters, it would take some more experimentation to figure them out.
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: Two GPL questions

Jon K Peck
Let me underline "save a particular template (and apply it to charts later
on) to control those parts of the chart.
"

There is no need to mess with the default chart template, which involves poking around in the xml unless there are permanent modifications you want to make that are not covered in the Edit > Options preference settings.




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




From:        Andy W <[hidden email]>
To:        [hidden email],
Date:        04/14/2014 05:58 AM
Subject:        Re: [SPSSX-L] Two GPL questions
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I have details on how to do the gridlines in my blog post,  Hacking the
default SPSS chart template
<
http://andrewpwheeler.wordpress.com/2012/01/03/hacking-the-default-spss-chart-template/>
. You can not control either directly in GPL - you either have to post-hoc
edit the chart or save a particular template (and apply it to charts later
on) to control those parts of the chart.

For gridlines the xml I have in my blog post looks like this:

<gridLines>
 <style color="#cccccc" stroke-dasharray="3px,6px" stroke-width="0.5pt"
visible="true"/>
</gridLines>

You can probably figure out how the xml options work. This xml is then
nested within a tag, <setAxisMajorTicks>, although I am guessing there is an
equivalent for minor ticks as well. Also note for another complication that
the <setAxisMajorTicks> can apply to either the x or y axis, and it can
apply to categorical or continuous scales.

I haven't played around with data labels much. What I do to check these
things is to make a quick chart and then save the chart template. Here I
added value labels and then edited the position of the labels through the
chart editor. Here is what I found:

       <addDataLabels colorByMarker="false" hidden="false"
labelLocationHorizontal="negative" labelLocationVertical="center">
               <style color="#000000" font-size="8pt" font-style="regular"
font-weight="regular" number="0" padding="2px" stroke-width="0.5pt"
visible="visible"/>
               <style color="transparent" color2="transparent" coordinate="1" number="1"
visible="true"/>
               <labeling variable="legend1"/>
       </addDataLabels>

So to control the location of the label the <addDataLabels> tag contains
parameters labelLocationHorizontal and labelLocationVertical. These
correspond to the grid options you have in the chart editor (I'm guessing
positive is the other option to get the labels to the right). Cartography
has pretty much come to agreement on that above and to the right is the
slightly preferential location for the label (which is the default in SPSS
charts) and top and to the left the second choice. But most of the time
overplotting is the bigger evil when placing labels, so they just go where
convenient.

I'm not 100% sure about the other data value parameters, it would take some
more experimentation to figure them out.



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Two-GPL-questions-tp5725422p5725423.html
Sent from the SPSSX Discussion mailing list archive at Nabble.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: Two GPL questions

PRogman
The more I use chart templates the more useful I find them. Until I recently I have overlooked the most useful feature of the possibility to apply multiple templates. I now keep a designated folder to hold my standard templates. The drawback is that I need to keep multiple folders synchronized at backup time, and when distributing syntax files I need so include the used templates. Also there is the need of more overhead work to set up my standard graph. I found the thoughts and 'hacks' of Andy Wheeler extremely useful (https://andrewpwheeler.wordpress.com/2012/01/03/hacking-the-default-spss-chart-template/). By the way I found where to block the chart statistics legend in standard histograms.
My templates are cleaned and minimized to just fix one or two standards, like Percentage Axis, Fill Colors, Text Label Size or visualization.
Also the FILE HANDLE makes it easier when moving/renaming folders.

/PR

Example syntax:
* Customize folder location *.
FILE HANDLE fpSPSSTemplates /NAME='%userprofile%\Documents\SPSS\Templates'.
* Templates *.
FILE HANDLE sgtChtBgGrid    /NAME='fpSPSSTemplates\ChartBgGrid.sgt'.
FILE HANDLE sgtChtYAxisPct  /NAME='fpSPSSTemplates\YScalePercent.sgt'.
FILE HANDLE sgtChtColSeq05  /NAME='fpSPSSTemplates\ColorBrewer2_SeqGray05.sgt'.

* the 'hacked' default template with altered background color and grid lines *.
SET CTEMPLATE='fpSPSSTemplates \chart_style-AW.sgt' .

*
GGRAPH
 /GRAPHDATASET
  NAME="graphdataset"
  VARIABLES=V1
            COUNT()[name="COUNT"]
            Cat
  MISSING=LISTWISE
  REPORTMISSING=NO
 /GRAPHSPEC
  SOURCE=INLINE
  TEMPLATE=[ sgtChtBgGrid
             sgtChtYAxisPct
             sgtChtColSeq05
           ].
BEGIN GPL
  SOURCE:  s=userSource(id("graphdataset"))
  DATA:    V1=col(source(s), name("V1"), unit.category())
  DATA:    COUNT=col(source(s), name("COUNT"))
  DATA:    Cat=col(source(s), name("Cat"), unit.category())
  GUIDE:   axis(dim(1), label("Condition"))
  GUIDE:   axis(dim(2), label("Percent"))
  GUIDE:   legend(aesthetic(aesthetic.color.interior), label("Categorical"))
  SCALE:   linear(dim(2), include(0))
  ELEMENT: interval.stack(position(summary.percent(V1*COUNT, base.coordinate(dim(1)))),
                          color.interior(Cat),
                          shape.interior(shape.square))
END GPL.

The template sgtChtBgGrid contains:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<template SPSS-Version="3.0"
                date="2014-01-15"
                description="Transparent chart background and Dashed XY grid lines"
                selectPath="12 13 "
                xmlns="http://www.ibm.com/software/analytics/spss/xml/visualization" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:schemaLocation="http://www.ibm.com/software/analytics/spss/xml/visualization http://www.ibm.com/software/analytics/spss/xml/visualization/vizml-template-3.5.xsd">

        <addFrame count="1" styleOnly="true" type="graph">
                <style color="transparent" color2="transparent" visible="true"/>
                <style color="#ffffff" color2="#000000" coordinate="1" number="1" visible="true"/>
        </addFrame>
        <setAxisMajorTicks>
                <majorTicks role="x" styleOnly="true">
                        <gridLines>
                                <style color="#cccccc" stroke-dasharray="3px,6px" stroke-width="0.5pt" visible="true"/>
                        </gridLines>
                </majorTicks>
        </setAxisMajorTicks>
        <setAxisMajorTicks>
                <majorTicks role="y" styleOnly="true">
                        <gridLines>
                                <style color="#cccccc" stroke-dasharray="3px,6px" stroke-width="0.5pt" visible="true"/>
                        </gridLines>
                </majorTicks>
        </setAxisMajorTicks>
</template>