I've searched for an answer but can't seem to find one...
We have a combination bar & line graph with "month - year" on the x-axis. We'd like to be able to color the bars different based on the year in the x-axis label string.
Well, maybe this will help explain it a little better. In addition to the x-axis displaying "month-year", it also doensn't go in chronological order. Here's an example of how the x-axis would look like:
I've got it in the order that I want...I just can't get each bar of the graph in the color that I want...
RED BLUE ORANGE RED BLUE ORANGE RED BLUE ORANGE BLUE ORANGE SILVER
10-2005 10-2006 10-2007 11-2005 11-2006 11-2007 12-2005 12-2006 12-2007 1-2006 1-2007 1-2008
Thanks for the help...we've got a VBAR2AX graph and it always plots the bar (y1) blue and the line (y2) orange...any ideas on that?
Shane
July 21, 2008, 12:37 PM
Tom Flynn
Hey Shane,
Each BAR, LINE is a series(##), so, if you are plotting 3 years * 12 months, that is 12 sets of 3; with VBAR2AX, adding VLINE, then 12 sets of 4, so, with a little modification to my previous post, should get you there.
Tom
Edit: If you are talking about the labels, try these:
Got it to work using the following code and style additions:
TABLE FILE KOITO_PRODUCTIVITY
SUM MIN.DATE_GROUP AS 'MIN_DATE_GROUP'
BY MONTH
SUM COMPUTE COST_PER_EARNED_HR/D12.2!D = EXPENSE / EARNED_HOURS;
COMPUTE IO_RATIO/D12.2 = KRONOS_HOURS / EARNED_HOURS;
BY MONTH
BY DATE_GROUP
BY DATE_DISP
WHERE MONTH NE 13;
WHERE ( ( DATE_GROUP GE '&START_MONTH' ) AND ( DATE_GROUP LE '&END_MONTH' ) )
&WHERE_DATE2.EVAL OR (( DATE_GROUP GE '&START_MONTH2' ) AND ( DATE_GROUP LE '&END_MONTH2' ))
&WHERE_DATE3.EVAL OR (( DATE_GROUP GE '&START_MONTH3' ) AND ( DATE_GROUP LE '&END_MONTH3' ))
;
WHERE ( DEPT_SUB_TYPE EQ '&PROCESS' );
&WHERECLAUSE;
ON TABLE HOLD AS CPEEHOLD
-*ON TABLE PCHOLD FORMAT HTML
END
-* NEW
DEFINE FILE CPEEHOLD
AYEAR/A4 = EDIT(DATE_GROUP,'9999');
END
TABLE FILE CPEEHOLD
BY AYEAR
ON TABLE SAVE AS CPEESAVE
-*ON TABLE PCHOLD FORMAT HTML
END
-RUN
-SET &YR2 = '';
-SET &YR3 = '';
-SET &YR4 = '';
-SET &YEARS=&LINES;
-REPEAT #GLABELS FOR &I FROM 1 TO &YEARS;
-READ CPEESAVE &YR.A4.
-SET &YR.&I=&YR;
-#GLABELS
-RUN
Here's one that's a bit shorter, and I didn't take the time to add the dialog manager to make the years dynamic. It would need some tweaking for the overall layout. I was just concentrating on the grouping.
DEFINE FILE GGSALES
DTE1/A8 = EDIT(DATE);
DTE2/A7 = EDIT(DTE1,'$$$$99-') || EDIT(DTE1,'9999');
DOLS/P13.2M = DOLLARS;
YR/YY = DATE;
END
GRAPH FILE GGSALES
SUM DOLS
BY YR
ACROSS DTE2 AS ''
WHERE YR EQ '1996' OR '1997';
ON GRAPH PCHOLD AS HOLD FORMAT PNG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRMERGE ON
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET GRID ON
ON GRAPH SET STYLE *
TYPE=DATA, COLOR=BLUE, WHEN=YR EQ 1996,$
TYPE=DATA, COLOR=GREEN, WHEN=YR EQ 1997,$
ENDSTYLE
ON GRAPH SET GRAPHSTYLE *
setLegendDisplay(false);
setMarkerDisplay(true);
setConnectLineMarkers(false);
setConnectScatterMarkers(false);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setY1LabelDisplay(true);
setY1AxisSide(0);
setY1MajorGridDisplay(true);
setY1MajorGridStyle(0);
setY1MinorGridDisplay(false);
setTextFormatPreset(getY1Label(), -1);
setTextFormatPattern(getY1Label(),"#.##");
setPieFeelerTextDisplay(1);
setPieLabelDisplay(0);
setTextFormatPreset(getPieSliceLabel(),1);
setRiserBorderMode(1);
setSeriesDefaultTransparentBorderColor(true);
setUseSeriesBorderDefaults(true);
setLegendDisplay(false);
setFontSizeAbsolute(getY1Title(),true);
setFontSizeAbsolute(getY1Label(),true);
setFontSizeAbsolute(getY2Title(),true);
setFontSizeAbsolute(getY2Label(),true);
setFontSizeAbsolute(getO1Title(),true);
setPlace(true);
ENDSTYLE
END
ttfn, kp
Access to most releases from R52x, on multiple platforms.