December 07, 2007, 10:15 AM
Lee MartinBar Graph Series/Grouping
Anyone know how to GROUP bars? I need to group PERCENTS together, and group COUNTS together on a bar chart. Here's and example:
GRAPH FILE CAR
SUM HEIGHT
COMPUTE HWPCT/D6.1 = HEIGHT/WIDTH * 100;
BY CAR AS ''
WHERE CAR EQ 'JENSEN' OR 'AUDI'
ON GRAPH SET LOOKGRAPH HBAR
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET BARNUMB ON
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHSTYLE *
setDepthRadius(0);
-* setData parms are: (Series number, Group number, VALUE)
-*setData(0,JENSEN,HEIGHT);
-*setData(0,AUDI,HWPCT);
-*setData(0,2,2);
-*setData(0,3,3);
-*setData(1,JENSEN,HEIGHT);
-*setData(1,AUDI,HWPCT);
-*setData(1,2,12);
-*setData(1,3,13);
setDataRangeToExtent();
setSeriesLabel(0,"Count");
setSeriesLabel(1,"Percent");
setGroupLabel(0,"Dashboard Met 1");
setGroupLabel(1,"Dashboard Met 2");
-*setGroupLabel(2,"Group 2");
-*setGroupLabel(3,"Group 3");
ENDSTYLE
END
It produces a BAR GRAPH with COUNT, PERCENT, COUNT, PERCENT,...in groupings. I would like it to produce a BAR CHART with COUNT,COUNT, then PERCENT, PERCENT. That is, COUNTS grouped together, and PERCENTS grouped together.
Any ideas?
Thanks in advance.
December 07, 2007, 11:54 AM
GinnyJakesHi, Lee.
Alternate master with OCCURS:
TABLE FILE CAR
SUM HEIGHT
COMPUTE HWPCT/D6.1 = HEIGHT/WIDTH * 100;
BY CAR AS ''
WHERE CAR EQ 'JENSEN' OR 'AUDI'
ON TABLE HOLD
END
DEFINE FILE HOLD
CNTFLAG/I1=1;
PCTFLAG/I1=2;
END
TABLE FILE HOLD
PRINT CNTFLAG HEIGHT PCTFLAG HWPCT
BY CAR
ON TABLE HOLD AS HOLD1 FORMAT ALPHA
END
You'd have to make the HEIGHT and the HWPCT the same format. Then in the alternate master what is currently cntflag and pctflag would have the same name.
SEGNAME=CNTSEG, SEGTYPE=S1,OCCURS=2 (in this case)
FIELDNAME=CNTFLAG,...
FIELDNAME=HFIELD...
Then graph using that master.
Just an idea. Let me know if you need more detail. I haven't worked the whole thing out.