Focal Point
How to change the LegendText in Graph

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

October 23, 2006, 01:44 PM
Kamesh
How to change the LegendText in Graph
Is there any method we have to change the legendText in Graph?

Like how we can change the Y1axis label or O1Label. I want to change the text for Legend.

Thanks in advance,


WFConsultant

WF 8105M on Win7/Tomcat
October 23, 2006, 02:21 PM
Francis Mariani
Wouldn't this do it?

setFontName(getO1Label(),"Arial Narrow");
setFontSize(getO1Label(),10);
setFontSizeAbsolute(getO1Label(),true);

setFontName(getY1Label(),"Arial Narrow");
setFontSize(getY1Label(),10);
setFontSizeAbsolute(getY1Label(),true);

Can't recall what the setFontSizeAbsolute is for, may not need it.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 23, 2006, 02:56 PM
Kamesh
That works but for me I want to change the LegendText.

Ex:

GRAPH FILE CAR
SUM DEALER_COST
BY CAR
ACROSS COUNTRY
END

The above code will show the legends as Country:BMW Country:Jaguar......

I want to remove Country in that. I can use setSeriesLabel("test") but I dont know how I can set this value based on BY field.

Hope I mentioned my problem clearly,


WFConsultant

WF 8105M on Win7/Tomcat
October 23, 2006, 04:44 PM
N.Selph
Try something like this:
 
setSeriesLabel(0,"Sunday");
setSeriesLabel(1,"Monday");
setSeriesLabel(2,"Tuesday");
setSeriesLabel(3,"Wednesday");
setSeriesLabel(4,"Thursday");
setSeriesLabel(5,"Friday");
setSeriesLabel(6,"Saturday");



(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)
October 24, 2006, 09:04 AM
Kamesh
setSeriesLabel will work for me but I dont know the text as I'm generating dynamic graph based on the selections in Front-end.

If we have any direct method then I can use, otherwise I have to save the across value and Read it in the graph properties and assign that read value in the setSeriesLabel. That's the solution I'm thinking.

Any other thoughts


WFConsultant

WF 8105M on Win7/Tomcat
October 24, 2006, 10:33 AM
Francis Mariani
I am confused about what your requirements are.

You mentioned "legend", but I don't think you're trying to affect the legend. Are you trying to change the text displayed in the "pop-up" (or "title text") when the cursor is moved over a graph element? Do you want to remove the name of the measure that's being graphed, but leave the name of the dimension and the measure value?

For example, if the pop-up displays as "SALES ENGLAND 12,000", do you want it to say "ENGLAND 12,000"? Here's a quick way to achieve that:
GRAPH FILE CAR
SUM
SALES AS ' '
BY COUNTRY AS 'COUNTRY'
END
Note the space character in SALES AS ' '.

If this is not want you want to do, then I apologise.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 24, 2006, 10:41 AM
Kamesh
Hi Francis,
I'm trying to change the text in Legend only. When I use setSeriesLabel, it modified that and as you said it modifies the pop-up text also. My requirement is to change the text in Legend.

Hope it's clear for you now. Still I'm confusing you, I apologise


WFConsultant

WF 8105M on Win7/Tomcat
October 24, 2006, 11:08 AM
Tony A
Kamesh,

When you use setSeriesLabel(n, "Text") the Legend will take up these values automatically. Or are you saying that you ONLY want the Legend text changed? If so then I think you may have hit a wall in as much that the Legend text is inferred from the series labels and no method or property, that I can see, will allow you to change the Legend text separately.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
October 24, 2006, 11:15 AM
Kamesh
Thanks Tony and Francis. I got it worked by saving the values in a table. Then read those values and assign it in setSeriesLabel. That works for me.


WFConsultant

WF 8105M on Win7/Tomcat
October 24, 2006, 11:58 AM
Tony A
Kamesh,

If you want to reduce the I/O (very slightly Wink) then instead of having to SAVE and READ the values, you could output then text setSeriesLabel(n, "text"); in your TABLE request -

TABLE FILE CAR
PRINT COMPUTE Sequence/I2 = IF CAR EQ LAST CAR THEN LAST Sequence ELSE LAST Sequence + 1; NOPRINT
      COMPUTE SeriesLabel/A200 =  'setSeriesLabel('|EDIT(Sequence)|',"'|CAR|'");';
BY CAR NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS S_Labels
END
-RUN

And then just -INCLUDE S_Labels in your graph style code. You'll have to FILEDEF the S_Labels.fex file first of course!

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
October 24, 2006, 01:21 PM
Kamesh
Thanks Tony. Let me try that.


WFConsultant

WF 8105M on Win7/Tomcat