As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I've searched and not finding my answer. I have a series of about 25 Stacked Bar Graphs graphs...using the same data in different ways. Everything is based on a Reason Code with about 15 differnt values. Some graphs may have only 3 reason codes ploted, some might have all 15. The user would like the Reasons to always be the same color. For instance..Reason 'FELL OFF THE BOAT' should always be Red. Reason "SUNK THE BOAT' Should always be Green and so on. I need to be able to control the setfillcolor based on the value of the Reason, not the Series or Group.This message has been edited. Last edited by: Prarie,
In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005
It's my guess that there is no way to do that via conventional means, but you could use WebFOCUS to generate the Java colour coding lines. This would unfortunately mean going through the data twice, once to produce the Java colour coding lines and once to produce the graph.
Here's a quick example that seems to work:
-*-- graph_fixed_colour.fex --------------------------------
-SET &ECHO='ALL';
SET ASNAMES=ON
SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA
-RUN
DEFINE FILE CAR
JAVACOLOR1/A23 = 'setFillColor(getSeries(';
JAVACOLOR2/A12 = '),new Color(';
JAVACOLOR3/A03 = '));';
COUNTRY_COLOUR/A11 = DECODE COUNTRY (
'ENGLAND' '255,0,0' ,
'FRANCE' '0,255,0' ,
'ITALY' '0,0,255' ,
'JAPAN' '0,255,255',
'W GERMANY' '255,255,0',
ELSE '255,0,255');
END
-RUN
TABLE FILE CAR
SUM
COMPUTE COUNTRY_COUNTA/D6 = COUNTRY_COUNTA + 1; NOPRINT
COMPUTE COUNTRY_COUNTB/D6 = COUNTRY_COUNTA - 1; NOPRINT
COMPUTE COUNTRY_COUNTC/A6 = STRIP(6, FTOA(COUNTRY_COUNTB, '(D6c)', 'A6'), ' ', 'A6'); NOPRINT
COMPUTE JAVACOLOURA/A200 =
JAVACOLOR1 || COUNTRY_COUNTC || JAVACOLOR2 || COUNTRY_COLOUR || JAVACOLOR3;
BY COUNTRY NOPRINT
WHERE COUNTRY NE 'ENGLAND'
ON TABLE HOLD AS HJAVACOLOUR
END
-RUN
GRAPH FILE CAR
SUM
SALES
BY COUNTRY
WHERE COUNTRY NE 'ENGLAND'
ON GRAPH SET GRAPHSTYLE *
-INCLUDE HJAVACOLOUR
ENDSTYLE
END
As long as the same filters are used in both passes though the data, this should work.
Try excluding a different Country and rerun the graph - England is always red, Germany is always yellow...
I realize this is a very simple graph and you may not be able to do this in a complex one.
The Country colour could be in an INCLUDE to standardize the colours used, so could some of the other code generating the Java colour coding lines.
Hopefully this gives you an idea or three...
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
There's one line for every graph object(?), from zero to 99. The computes just create the 0, 1, 2, 3... The first compute creates 1, 2, 3, 4... The second compute subtracts 1 from the value to get 0, 1, 2, 3... The third converts the value to alpha and strips the leading blanks. This is then used in the final compute to generate the Java colour coding line.
Run this code to see what happens:
-SET &ECHO='ALL';
SET ASNAMES=ON
SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA
-RUN
DEFINE FILE CAR
JAVACOLOR1/A23 = 'setFillColor(getSeries(';
JAVACOLOR2/A12 = '),new Color(';
JAVACOLOR3/A03 = '));';
COUNTRY_COLOUR/A11 = DECODE COUNTRY (
'ENGLAND' '255,0,0' ,
'FRANCE' '0,255,0' ,
'ITALY' '0,0,255' ,
'JAPAN' '0,255,255',
'W GERMANY' '255,255,0',
ELSE '255,0,255');
END
-RUN
TABLE FILE CAR
SUM
COMPUTE COUNTRY_COUNTA/D6 = COUNTRY_COUNTA + 1;
COMPUTE COUNTRY_COUNTB/D6 = COUNTRY_COUNTA - 1;
COMPUTE COUNTRY_COUNTC/A6 = STRIP(6, FTOA(COUNTRY_COUNTB, '(D6c)', 'A6'), ' ', 'A6');
COMPUTE JAVACOLOURA/A200 =
JAVACOLOR1 || COUNTRY_COUNTC || JAVACOLOR2 || COUNTRY_COLOUR || JAVACOLOR3;
BY COUNTRY NOPRINT
-*WHERE COUNTRY NE 'W GERMANY'
-*ON TABLE HOLD AS HJAVACOLOUR
END
-RUN
-EXIT
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
GRAPH FILE..... SUM FIELD1 CHECKVALUE NOPRINT BY FILED2 ACROSS FIELD3 ..... ENDSTYLE ON GRAPH SET STYLE * DEFMACRO=Condition_1, COLOR=RGB(0 100 0), WHEN=N3 EQ 'Y', $ DEFMACRO=Condition_2, COLOR=RGB(255 215 0), WHEN=N3 EQ 'N', $ TYPE=DATA, ACROSSCOLUMN=N1, MACRO=Condition_1, $ TYPE=DATA, ACROSSCOLUMN=N1, MACRO=Condition_2, $ ENDSTYLE
I'm graphing a 4 series, but only show two colors depending on another field that I don't display.
Check out th Applying Conditional Styling to a graph section of the Creating Reports with WebFOCUS Language....This message has been edited. Last edited by: Laure,
The method I posted, while it will display a legend, I haven't been able to control the colors. They default. Maybe someone else has been able to do this?
Francis, Your code works great and I'm looking to adapt it to keep static colors for multiple graphs shown on the same BID page and display those same colors in the legend which my . The issue I'm having is that I can not get your code to run under MRE. The -INCLUDE looks for a FEX and gives me an error.
Error occurred. ERROR: ERROR_MR_FEX_NOT_FOUND Can't create item object based on provided item key HJAVACOLOUR.fex.
I've tried setting the APP HOLD to the application folder and then doing -INCLUDE APP/HJAVACOLOUR
but still I get the same error. Do you have a suggestion on how to get around MRE looking for a .FEX on the -INCLUDE?
I have never been able to get this to work. Here is what I have below. Some of the graphs may have only 3 reasons...some may have all of them. So the colors are never consistant. Any other thoughts on this?