Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Undecided]Graph Value Color

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Undecided]Graph Value Color
 Login/Join
 
Virtuoso
posted
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, 2005Report This Post
Expert
posted Hide Post
Prarie,

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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Thanks Francis...that is very interesting and brings up a lot of possiblities..but I'm afraid I'm lost on what Country_count computes are for?
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Expert
posted Hide Post
I'm sorry I gave no explanations! If you "View Source" you'll see that the Java colour coding lines look like this:

setFillColor(getSeries(0),new Color(0,0,255));
setFillColor(getSeries(1),new Color(255,0,0));
setFillColor(getSeries(2),new Color(255,255,0));
setFillColor(getSeries(3),new Color(0,255,0));
...


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Ok...I get it...let me play and see what I can do. Thanks...I'll report back.
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Gold member
posted Hide Post
I'm doing this with the following code

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,


Laure


Prod: WebFOCUS 7.7.03 - MRE, BID, - WindowsXP - Oracle 9i, SQLServer, DevStudio 7.7.3 - Apache Tomcat , Output: HTML, Excel 2013 and PDF
 
Posts: 78 | Location: Florida | Registered: December 07, 2006Report This Post
Expert
posted Hide Post
That makes things a lot easier! Merci Laure!

-SET &ECHO='ALL';

GRAPH FILE CAR
SUM
COUNTRY NOPRINT
SALES

ACROSS COUNTRY

-*WHERE COUNTRY NE 'W GERMANY'

ON GRAPH SET STYLE *
TYPE=REPORT, ACROSSCOLUMN=SALES, COLOR=RGB(255 0 255), $
TYPE=REPORT, ACROSSCOLUMN=SALES, COLOR=RGB(255 0 255), $
TYPE=REPORT, ACROSSCOLUMN=SALES, COLOR=RGB(255 0 0)  , WHEN= COUNTRY EQ 'ENGLAND'  , $
TYPE=REPORT, ACROSSCOLUMN=SALES, COLOR=RGB(0 255 0)  , WHEN= COUNTRY EQ 'FRANCE'   , $
TYPE=REPORT, ACROSSCOLUMN=SALES, COLOR=RGB(0 0 255)  , WHEN= COUNTRY EQ 'ITALY'    , $
TYPE=REPORT, ACROSSCOLUMN=SALES, COLOR=RGB(0 255 255), WHEN= COUNTRY EQ 'JAPAN'    , $
TYPE=REPORT, ACROSSCOLUMN=SALES, COLOR=RGB(255 255 0), WHEN= COUNTRY EQ 'W GERMANY', $
ENDSTYLE
END


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Well I had already done Fransis method when i saw the other tip..and now I have control of my colors...but I have no legend anymore. Confused
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Gold member
posted Hide Post
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?


Laure


Prod: WebFOCUS 7.7.03 - MRE, BID, - WindowsXP - Oracle 9i, SQLServer, DevStudio 7.7.3 - Apache Tomcat , Output: HTML, Excel 2013 and PDF
 
Posts: 78 | Location: Florida | Registered: December 07, 2006Report This Post
<JG>
posted
You need to add

ON GRAPH SET GRAPHSTYLE *
setDepthRadius(0);
setSeriesAreRows(false);
setLegendDisplay(true);
setPlace(true);
ENDSTYLE
 
Report This Post
Gold member
posted Hide Post
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?


Laure


Prod: WebFOCUS 7.7.03 - MRE, BID, - WindowsXP - Oracle 9i, SQLServer, DevStudio 7.7.3 - Apache Tomcat , Output: HTML, Excel 2013 and PDF
 
Posts: 78 | Location: Florida | Registered: December 07, 2006Report This Post
Expert
posted Hide Post
Hi Laurie,

Just put -MRNOEDIT in front of the -INCLUDE. Works in 7.6.8:

-MRNOEDIT -INCLUDE HJAVACOLOUR

Say HI to everyone...Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Gold member
posted Hide Post
Thanks, I was just testing with the MRNOEDIT when you email popped in.

I'll pass on the hello to the gang.


Laure


Prod: WebFOCUS 7.7.03 - MRE, BID, - WindowsXP - Oracle 9i, SQLServer, DevStudio 7.7.3 - Apache Tomcat , Output: HTML, Excel 2013 and PDF
 
Posts: 78 | Location: Florida | Registered: December 07, 2006Report This Post
Virtuoso
posted Hide Post
I have never been able to make this work properly...will keep playing. My Graphs are quite complex...with Loops and stuff. Frowner
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Virtuoso
posted Hide Post
I'm back.

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?

DEFINE FILE DEM_HOLD1 ADD
JAVACOLOR1/A23 = 'setFillColor(getSeries(';
JAVACOLOR2/A12 = '),new Color(';
JAVACOLOR3/A03 = '));';
REASON_COLOUR/A11 = DECODE DEMURRAGE_REASON_DEF (
'COMMERCIAL DECISION' '455,0,0' ,
'CONTRACT ISSUE' '0,255,500' ,
'LIGHTERING OPERATIONS' '400,0,255' ,
'DESPATCH' '0,255,455',
'PORT/WATERWAY RESTRICTION' '655,255,0',
'PRODUCT NOT AVAIL' '0,50,750' ,
'CONTRACT ISSUE' '0,500,200' ,
'LIGHTERING OPERATIONS' '0,150,350' ,
'PRODUCT QUALITY' '0,400,100',
'PRODUCT TOO HOT' '0,650, 50',
'SHORE PERSONNEL' '50,0,850',
'CONTRACT ISSUE' '600,0,200',
'TERM VESSEL IDLE TIME' '150,0,450',
'TRUCK CONGESTION' '600,0,100',
'VALERO DOCK: BERTH NOT AV' '250,0,80',
'VALERO SHORE OPERATIONS' '450,250, 50' ,
'VALERO TANK NOT AVAILABLE' '50, 50, 50' ,
'LIGHTERING OPERATIONS' '100,100,100' ,
'VESSEL ISSUES' '150,150,150',
'WEATHER' '200,200,200',
ELSE '0, 0,250' );
END
TABLE FILE DEM_HOLD1
SUM

COMPUTE COUNTRY_COUNTA/D8 = COUNTRY_COUNTA + 1; NOPRINT
COMPUTE COUNTRY_COUNTB/D8 = COUNTRY_COUNTA - 1; NOPRINT
COMPUTE COUNTRY_COUNTC/A8 = STRIP(8, FTOA(COUNTRY_COUNTB, '(D8c)', 'A8'), ' ', 'A8'); NOPRINT
COMPUTE JAVACOLOURA/A200 =
JAVACOLOR1 || JAVACOLOR2 || REASON_COLOUR || JAVACOLOR3;

BY DEMURRAGE_REASON_DEF NOPRINT
ON TABLE HOLD AS JAVACOLOX
END
TABLE FILE JAVACOLOX
PRINT JAVACOLOURA
ON TABLE HOLD AS JAVACOLOR
END
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Gold member
posted Hide Post
Try adding the COUNTRY_COUNTC into the concatenation and holding format ALPHA

  
COMPUTE JAVACOLOURA/A200 =
JAVACOLOR1 || COUNTRY_COUNTC  || JAVACOLOR2 || REASON_COLOUR || JAVACOLOR3;
ON TABLE HOLD AS HJAVAC FORMAT ALPHA
END 



Then
GRAPH FILE....

ON GRAPH SET GRAPHSTYLE *
-MRNOEDIT BEGIN
-INCLUDE HJAVAC
-MRNOEDIT END
....
END


Laure


Prod: WebFOCUS 7.7.03 - MRE, BID, - WindowsXP - Oracle 9i, SQLServer, DevStudio 7.7.3 - Apache Tomcat , Output: HTML, Excel 2013 and PDF
 
Posts: 78 | Location: Florida | Registered: December 07, 2006Report This Post
Virtuoso
posted Hide Post
Good Eye.
Wink


I did have it that way...and tried it this way right before I cut and paste...didnt' make a difference either way...
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Undecided]Graph Value Color

Copyright © 1996-2020 Information Builders