February 18, 2008, 11:15 AM
ypatelNot able to display legend with one field on BAR graph
Like to know if there is any way we can display a legend when there is one field in tbe bar graph.
Saw some previous posts and found the legend could be displayed with VAREA graph but the same technique didn't work with BAR graph.
Here is the demo code.
GRAPH FILE CAR
SUM DEALER_COST AS 'DEALER COST'
BY COUNTRY
BY MODEL
WHERE COUNTRY EQ 'ITALY';
-* try also commenting above condition
ON GRAPH SET LOOKGRAPH HBAR
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET GRID ON
ON GRAPH SET GRMERGE ON
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET GRAPHSTYLE *
setDisplay(getAnnotation(0), true);
-*setTextString(getAnnotation(0), "&COUNTRY");
setRect(getAnnotation(0),new Rectangle(500,-14850,1500,100));
setFillColor(getAnnotation(0), new Color(0,0,0));
setMarkerDisplay(true);
setConnectLineMarkers(false);
setConnectScatterMarkers(false);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setAxisAssignment(0,0);
setSeriesType(0,1);
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(true);
setFontSizeAbsolute(getY1Title(),true);
setFontSizeAbsolute(getY1Label(),true);
setFontSizeAbsolute(getY2Title(),true);
setFontSizeAbsolute(getY2Label(),true);
setFontSizeAbsolute(getO1Title(),true);
setFontSizeAbsolute(getO1Label(),true);
setPlace(true);
ENDSTYLE
ON GRAPH SET STYLE *
PAGESIZE='Letter',
LEFTMARGIN=0.250000,
RIGHTMARGIN=0.250000,
TOPMARGIN=0.250000,
BOTTOMMARGIN=0.250000,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='TIMES NEW ROMAN',
SIZE=10,
BACKCOLOR='NONE',
STYLE=NORMAL,
$
ENDSTYLE
END
February 18, 2008, 12:31 PM
GinnyJakesI played around with a couple of the legend properties, commented out the BY on COUNTRY which you don't need, and couldn't get it to work.
Do you have access to the graph manual with the API commands? If not, you can download it.
Sorry I couldn't help.
February 18, 2008, 12:39 PM
ypatelGinny, Yes I do have graph manual and did go thru several alternatives to show legend but seems like it only show up if we have more than one field in the main verb.
Thanks for looking into this.
March 17, 2008, 01:05 AM
PiipsterThis is expected behaviour.
Refer to this link for a solution:
http://techsupport.informationbuilders.com/sps/12022119.htmlNote that there is one error in it:
ENDSTYLE
should be
END GRAPHSTYLE
(Tested in R761)