Hi Everybody
i'm working on a GPL syntax (see below) I'v managed to show the data labels, but they are too small. How can I enlarge them? Thanks Nico *********************** GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=PLT(v11_1, 2) PLT(v11_2, 2) PLT(v11_3, 2) PLT(v11_4, 2) PLT(v11_5, 2) MISSING=LISTWISE REPORTMISSING=NO TRANSFORM=VARSTOCASES(SUMMARY="#SUMMARY" INDEX="#INDEX") /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: SUMMARY=col(source(s), name("#SUMMARY")) DATA: INDEX=col(source(s), name("#INDEX"), unit.category()) SCALE: cat(dim(1), include("0", "1", "2", "3", "4")) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(INDEX*SUMMARY), shape.interior(shape.square), label(SUMMARY)) END GPL. |
This post was updated on .
You can achieve this by applying a custom Chart Template.
1. First generate the chart as per normal 2. Right click chart in output window-->"Edit Content" 3. Double click any data label 4. Increase "Preferred size" to desired font size 5. Click "Apply" 6. "File"--->"Save Chart template" 7. Select only "Font style (Font, font size, etc.)" 8. Click "Continue" 9. Save to desired folder location. 10. Include the syntax "TEMPLATE=["C:\Users\JigneshSutar\test.sgt"]" in the original GPL/GGRAPH syntax. Example below with the chart template attached to this post also. If you need the font size to be anything other than point 11 then it's simply a case of editing the .sgt template in any text editor and updating the snippet of code font-size="11pt" IncreaseDataLabelFontSizePt11.sgt INPUT PROGRAM. LOOP #x=1 to 2. LOOP #y=1 to 12. COMPUTE ID=(#x-1)*12+#y. COMPUTE Date=DATE.DMY(1,#y,2014). END CASE. END LOOP. END LOOP. END FILE. END INPUT PROGRAM. EXECUTE. formats Date (adate). set seed = 10. compute Spend=rv.uniform(0,1)*100. ctables /table date[c] by Spend[s] [mean f8.2 validn f8.0 minimum f8.1 maximum f8.1]. * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=date MEAN(Spend)[name="MEAN_Spend"] MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE TEMPLATE=["C:\Users\JigneshSutar\IncreaseDataLabelFontSizePt11.sgt"]. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: date=col(source(s), name("date")) DATA: MEAN_Spend=col(source(s), name("MEAN_Spend")) GUIDE: axis(dim(1), label("date")) GUIDE: axis(dim(2), label("Mean Spend")) ELEMENT: line(position(date*MEAN_Spend), label(MEAN_Spend)) END GPL. |
I edited my initial post (the link to the template file had pasted into the body of the GPL syntax) so best to view the corrected post via Nabble: http://spssx-discussion.1045642.n5.nabble.com/data-lable-size-in-GPL-td5728791.html#a5728792
|
...or alternatively using INLINETEMPLATE (Thanks Bob for the nudge off-line!):
* Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=date MEAN(Spend)[name="MEAN_Spend"] MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE INLINETEMPLATE=["<addDataLabels styleOnly='true'><style color='#000000' font-size='14pt'/></addDataLabels>"]. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: date=col(source(s), name("date")) DATA: MEAN_Spend=col(source(s), name("MEAN_Spend")) GUIDE: axis(dim(1), label("date")) GUIDE: axis(dim(2), label("Mean Spend")) ELEMENT: line(position(date*MEAN_Spend), label(MEAN_Spend)) END GPL. |
Free forum by Nabble | Edit this page |