Controlling Value Label on Charts

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

Controlling Value Label on Charts

cmacken
I have been using the following to create charts:
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Scale_Score Group_desc
MISSING=LISTWISE
    REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE INLINETEMPLATE=["<addDataLabels><labeling
variable='percent'></labeling></addDataLabels>"]  .
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: Scale_Score=col(source(s), name("Scale_Score"))
  DATA: Group_desc=col(source(s), name("Group_desc"), unit.category())
  GUIDE: axis(dim(1), label("Score"))
  GUIDE: axis(dim(2), label("Frequency Percent"))
  GUIDE: axis(dim(4), label("Course"), opposite())
  SCALE: cat(dim(4), include("AP U", "US H"))
  ELEMENT:
interval(position(summary.percent.count(bin.rect(Scale_Score*1*1*Group_desc)
,
    base.all())), shape.interior(shape.square))
END GPL.

The value labels appear on the bar graphs, but they are not formatted as I
wish.  I want to be able to control the number of decimal places that are
printed, the font size of the values, and increase the value label
background area. I tried adding <format maximumfractiondigits="1"
suffix="%"/> to the Inlinetemplate statement, but it appears to have no
effect.  What syntax would I use to accomplish this?

=====================
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: Controlling Value Label on Charts

Lemon, John S.
Candace

Have you tried editing the chart that is generated with the 'chart editor' to get the appearance that you want, saving the chart template and then using that in the syntax. I've found that this is one way to do it and you can 'see' what you want before saving the template.

Best Wishes

John S. Lemon
Student Liaison Officer
IT Services - University of Aberdeen

t:  +44 (0) 1224 273350 | m: +44 (0) 7710 491780 | e:[hidden email] | www.abdn.ac.uk/it/

Use MyIT to log calls with IT Services, and to update and check the status of your calls - https://myit.abdn.ac.uk


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Candace Macken
Sent: 17 January 2014 11:34
To: [hidden email]
Subject: Controlling Value Label on Charts

I have been using the following to create charts:
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Scale_Score Group_desc MISSING=LISTWISE
    REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE INLINETEMPLATE=["<addDataLabels><labeling
variable='percent'></labeling></addDataLabels>"]  .
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: Scale_Score=col(source(s), name("Scale_Score"))
  DATA: Group_desc=col(source(s), name("Group_desc"), unit.category())
  GUIDE: axis(dim(1), label("Score"))
  GUIDE: axis(dim(2), label("Frequency Percent"))
  GUIDE: axis(dim(4), label("Course"), opposite())
  SCALE: cat(dim(4), include("AP U", "US H"))
  ELEMENT:
interval(position(summary.percent.count(bin.rect(Scale_Score*1*1*Group_desc)
,
    base.all())), shape.interior(shape.square)) END GPL.

The value labels appear on the bar graphs, but they are not formatted as I wish.  I want to be able to control the number of decimal places that are printed, the font size of the values, and increase the value label background area. I tried adding <format maximumfractiondigits="1"
suffix="%"/> to the Inlinetemplate statement, but it appears to have no effect.  What syntax would I use to accomplish this?

=====================
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
The University of Aberdeen is a charity registered in Scotland, No SC013683.

=====================
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: Controlling Value Label on Charts

Andy W
In reply to this post by cmacken
I'm not 100% sure about chart value labels, but often charts inherit the formatting of the variables that they are graphing. So maybe try setting Group_desc to F?.0 (not sure if this applies when using the summary functions though - but advice would apply for Y-axis if you summarized the data yourself and then plotted).

For the other stuff I agree with John Lemon, they are only possible by making a template.
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/