Focal Point
[SOLVED] not able to display Legend for single values

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2881092232

June 13, 2007, 02:54 AM
<amarnath>
[SOLVED] not able to display Legend for single values
Hi ,

I am working on a graph report. I have a problem with the display of legend .
Able to display legend for multiple values but not able to display for single value.
Ex:

I am plotting a graph using one numeric field & one alphanumeric across a month field.
Whenever there are multiple months in the data It is displaying Legend for all the months presented.
But if I have only one month it is not displaying the legend.


I am copying the sample code here (developed using CAR master file). Please check the code once and let me know if u get any clue.

-****************************
-* File testcar.fex
GRAPH FILE CAR
SUM DEALER_COST AS ''
ACROSS MODEL
BY COUNTRY
WHERE COUNTRY EQ 'ITALY'
-* try also commenting above condition
ON GRAPH SET LOOKGRAPH VAREA
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 GRWIDTH 0
ON GRAPH SET GRMERGE ON
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET GRAPHSTYLE *
setMarkerDisplay(true);
setConnectLineMarkers(false);
setConnectScatterMarkers(false);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setAxisAssignment(0,0);
setSeriesType(0,3);
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);
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,
$
TYPE=HEADING,
LINE=1,
OBJECT=FIELD,
ITEM=1,
COLOR='BLACK',
$
ENDSTYLE
END



-****************************
Please let me know the solution ASAP



Thanks & Regards
Amarnath.k

This message has been edited. Last edited by: Kerry,
June 14, 2007, 02:47 PM
FortuneCookie
It would probably help if you let us know what you are running where it fails.

I've tried this in 7.1.6 WebFOCUS via Adhoc page and the LEGEND shows up for me.


Prod: WebFOCUS 7.1.6, Windows 2003

Dev: WebFOCUS 7.6.2, Windows 2003
June 14, 2007, 07:43 PM
N.Selph
I tried the code in version 7.13, and the Legend exists ( a little blue square below the x-axis title), but it is not labelled (you would expect the label of "ITALY").


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
June 15, 2007, 01:34 AM
Piipster
Try this for a workaround:

-DEFAULT &VARCTR = 1
-DEFAULT &COUNTRY = 'ITALY'

GRAPH FILE CAR

SUM DEALER_COST AS ''
ACROSS MODEL
BY COUNTRY
WHERE COUNTRY EQ '&COUNTRY'

-* try also commenting above condition
ON GRAPH SET LOOKGRAPH VAREA
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 GRWIDTH 0
ON GRAPH SET GRMERGE ON
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET GRAPHSTYLE *
setMarkerDisplay(true);
setConnectLineMarkers(false);
setConnectScatterMarkers(false);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setAxisAssignment(0,0);
setSeriesType(0,3);
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);

-IF &VARCTR NE 1 GOTO SKIP_ANNOT;
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));
-SKIP_ANNOT

setFontSizeAbsolute(getY1Title(),true);
setFontSizeAbsolute(getY1Label(),true);
setFontSizeAbsolute(getY2Title(),true);
setFontSizeAbsolute(getY2Label(),true);
setFontSizeAbsolute(getO1Title(),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,
$
TYPE=HEADING,
LINE=1,
OBJECT=FIELD,
ITEM=1,
COLOR='BLACK',
$
ENDSTYLE
END


ttfn, kp


Access to most releases from R52x, on multiple platforms.
October 12, 2009, 04:28 PM
Prarie
Is there another solution to this? I don't think this work around is going to work for me. Why would it not display the Legend Display if it's one value? This makes no sense. If it's only one value...you just should know what it is? Confused


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
JG? Anybody?
Amarnath,

Can you tell you which release you are seeing this issue in? I ran your code in both WF 7.6.9 and 7.6.10 releases and saw the legend appear on the chart.
This was an old issue for him...this is my issue now...You see the Word ITALY under the purple square when you run the orginal graph?


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Prarie, I have done an internal search and unfortunately it's a known bug supposedly fixed in 7.6.5,
have you tried it on your 7.6.5 test environment.

It does work in 7.6.6 and above.

One possible solution that I saw was instead of coding ON GRAPH SET LOOKGRAPH VAREA
explicitly set the graph type using the API call
e.g. setGraphType(31);

Never know might work.
JG, that's an excellent idea. I actually tried it in Release 7.6.1 and it worked. I modified the original fex to show a working example.

-DEFAULT &VARCTR = 1
-DEFAULT &COUNTRY = 'ITALY'

GRAPH FILE CAR

SUM DEALER_COST AS ''
ACROSS MODEL
BY COUNTRY
WHERE COUNTRY EQ '&COUNTRY'

-* try also commenting above condition
-*VLozovsky: changed VAREA to VLINE
ON GRAPH SET LOOKGRAPH VLINE
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 GRWIDTH 0
ON GRAPH SET GRMERGE ON
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET GRAPHSTYLE *
setMarkerDisplay(true);
setConnectLineMarkers(false);
setConnectScatterMarkers(false);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setAxisAssignment(0,0);
-*VLozovsky: api call below will visualize the line chart as an area
setSeriesType(0,3);
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);

-IF &VARCTR NE 1 GOTO SKIP_ANNOT;
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));
-SKIP_ANNOT

setFontSizeAbsolute(getY1Title(),true);
setFontSizeAbsolute(getY1Label(),true);
setFontSizeAbsolute(getY2Title(),true);
setFontSizeAbsolute(getY2Label(),true);
setFontSizeAbsolute(getO1Title(),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,
$
TYPE=HEADING,
LINE=1,
OBJECT=FIELD,
ITEM=1,
COLOR='BLACK',
$
ENDSTYLE
END
Vlozovsky -

That work around will not work for me...because the real graph will some days have one value and others have several.

JG I'll try your suggestion.
Come on Prarie wake up, you know better than that.
What's actually missing from the work around is the first step.

TABLE FILE CAR
SUM DEALER_COST AS ''
ACROSS MODEL
BY COUNTRY
ON TABLE SAVE
END
-RUN
-SET &&VARCTR = &LINES;

That accomodates the bypass if more than 1 exists.
Yes you are correct I was not awake, and was coming back to say...I got it! Brain was not with me earlier.