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     [SOLVED] Assign color based on series value in graphs

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Assign color based on series value in graphs
 Login/Join
 
Platinum Member
posted
I have this graph that can have variable number of series depending on the parameter.

For example, one run may have 9 status. In other runs, it might be just 1 status.

GRAPH FILE TEMPHOLD
SUM PCT.NEWMINUTES AS '' WAFERSFINISHED AS 'WFR'
ACROSS DAYFMT AS ''
BY STATUS ROWS 'Running' OVER 'Idle' OVER 'PM' OVER 'Setup' OVER 'Maint' OVER 'Other' OVER 'Stop' OVER 'Offline' OVER 'Down'
ON GRAPH SET LOOKGRAPH VBRSTK2
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 VAXIS 450
ON GRAPH SET HAXIS 1200
ON GRAPH SET GRMERGE ON
ON GRAPH PCHOLD FORMAT JPEG
ON GRAPH SET GRAPHSTYLE *
:
:
-*RUN (GREEN)
setFillColor(getSeries(0),new Color(51,204,51)));
-*setFillColor(getSeries(1),new Color(0,0,255))); THIS IS THE GREEN LINE

-*IDLE (BLUE)
setFillColor(getSeries(2),new Color(0,0,255)));
setFillColor(getSeries(3),new Color(0,0,0)));

-*PM (YELLOW)
setFillColor(getSeries(4),new Color(255,255,0)));
-*setFillColor(getSeries(5),new Color(0,0,0)));

-*SETUP (ORANGE)
setFillColor(getSeries(6),new Color(255,102,51)));
setFillColor(getSeries(7),new Color(0,0,0)));

-*MAINT (LIGHT VIOLET/BLUE)
setFillColor(getSeries(8),new Color(153,153,204)));
setFillColor(getSeries(9),new Color(0,0,0)));

-*OTHER (NEON BLUE)
setFillColor(getSeries(10),new Color(0,102,255)));
setFillColor(getSeries(11),new Color(0,0,0)));

-*STOP (BLACK)
setFillColor(getSeries(12),new Color(0,0,0)));
setFillColor(getSeries(13),new Color(0,0,0)));

-*OFFLINE (PINK)
setFillColor(getSeries(14),new Color(255,102,204)));
setFillColor(getSeries(15),new Color(0,0,0)));

-*DOWN (RED)
setFillColor(getSeries(16),new Color(255,0,0)));
setFillColor(getSeries(17),new Color(0,0,0)));
:
:

If I have all the status, RUNNING to DOWN, my graph looks okay. The color matches status (running is green, idle is blue..)

However, if I run the report and returns only 1 status (e.g. IDLE), it displays it as GREEN in my graph when it should be BLUE.

Is there a way to create a conditional graph style based on the series data value?

Thanks.

This message has been edited. Last edited by: <Kathryn Henning>,


Dev: WebFOCUS 7.6.10, Data Migrator 7.6.10
QA: WebFOCUS 7.6.10, Data Migrator 7.6.10
Prod: WebFOCUS 7.6.2, Data Migrator 7.6.8
Windows 2K3, Tomcat 5.5.17, IIS 6
Usage: HTML, PDF, Excel, Self-serve, BID and MRE
 
Posts: 197 | Location: Roseville, CA | Registered: January 24, 2005Report This Post
Expert
posted Hide Post
I would be inclined to approach this from a different angle.

You want all the status' irrespective of whether they exist? Then create a temporary file within your fex that has all the status' within it and then join that as parent to your other data as child. You status will always exist and therefore you will always have a series value (even if it is NULL or MISSING). It follows that your colour scheme should always be correct.

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
Also, you can use Dialogue Manager to loop through your API commands and adjust the color depending on the loop number and any other conditions you might have.

You'll have to do some preprocessing to get &LINES and what kind of series you have. The series number and the color codes will have to be variables. You can set the color codes with a decode.

Let me know if this is not clear and I can try to supply more detail.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Platinum Member
posted Hide Post
Thanks for the responses.

I started doing DM commnands last night but had to wait awhile due to the number of permutations of the status field.

Let my try your suggestion Tony.


Dev: WebFOCUS 7.6.10, Data Migrator 7.6.10
QA: WebFOCUS 7.6.10, Data Migrator 7.6.10
Prod: WebFOCUS 7.6.2, Data Migrator 7.6.8
Windows 2K3, Tomcat 5.5.17, IIS 6
Usage: HTML, PDF, Excel, Self-serve, BID and MRE
 
Posts: 197 | Location: Roseville, CA | Registered: January 24, 2005Report This Post
Platinum Member
posted Hide Post
Your suggestion Tony works. Now, I don't need to change the graph style settings.


Dev: WebFOCUS 7.6.10, Data Migrator 7.6.10
QA: WebFOCUS 7.6.10, Data Migrator 7.6.10
Prod: WebFOCUS 7.6.2, Data Migrator 7.6.8
Windows 2K3, Tomcat 5.5.17, IIS 6
Usage: HTML, PDF, Excel, Self-serve, BID and MRE
 
Posts: 197 | Location: Roseville, CA | Registered: January 24, 2005Report This Post
Expert
posted Hide Post
Glad it worked for you Smiler

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Silver Member
posted Hide Post
Great! I know how this can be done in SQL Server:

DECLARE @Colors TABLE
(
Color varchar(50)
)

INSERT INTO @Colors
VALUES ('Red'), ('White'), ('Blue')

DECLARE @TestData TABLE
(
Groop varchar(50),
Color varchar(50),
Measure int
)

-- No White color in test data
INSERT INTO @TestData (color, Groop, Measure)
VALUES ('Red', 'One', 150), ('Red', 'Two', 40), ('Blue', 'One', 400), ('Blue', 'Two', 100)

-- Report on all colors
SELECT ac.Groop, ac.Color, ISNULL(td.Measure,0) AS Measure
FROM
(
SELECT DISTINCT Groop, c.Color
FROM @TestData td
CROSS JOIN @Colors c
) ac
LEFT OUTER JOIN @TestData td
ON ac.Color = td.Color AND ac.Groop = td.Groop

I have struggled with the WebFOCUS JOIN like forever, but it remains foreign to me.
Can anyone give a hint?

This message has been edited. Last edited by: Marc97229,


WebFOCUS 8.0.0.8, Windows 7
 
Posts: 36 | Location: Portland, OR (USA) | Registered: October 11, 2012Report This Post
Silver Member
posted Hide Post
I doubt this is the most elegant way, but it does yield what I want:

APP FILEDEF TESTMAS DISK testdata.mas
-RUN
-WRITE TESTMAS FILENAME=TESTDATA,SUFFIX=FIX
-WRITE TESTMAS SEGNAME=TESTDATA,SEGTYPE=S0
-WRITE TESTMAS FIELDNAME=COLOR ,ALIAS=COLOR ,FORMAT=A7 ,ACTUAL=A7 ,$
-WRITE TESTMAS FIELDNAME=GROEP ,ALIAS=GROEP ,FORMAT=A5 ,ACTUAL=A5 ,$
-WRITE TESTMAS FIELDNAME=MEASURE ,ALIAS=MEASURE ,FORMAT=I4 ,ACTUAL=A4 ,$

APP FILEDEF TESTDATA DISK testdata.ftm
-RUN

-*-WRITE TESTDATA Rood Grp 1 35
-*-WRITE TESTDATA Rood Grp 2 95
-*-WRITE TESTDATA Wit Grp 1 15
-*-WRITE TESTDATA Wit Grp 2 25
-WRITE TESTDATA Blauw Grp 1 25
-WRITE TESTDATA Blauw Grp 2 28
-RUN

APP FILEDEF COLORMAS DISK colordata.mas
-RUN
-WRITE COLORMAS FILENAME=COLORDATA,SUFFIX=FIX
-WRITE COLORMAS SEGNAME=COLORDATA,SEGTYPE=S0
-WRITE COLORMAS FIELDNAME=COLOR ,ALIAS=COLOR ,FORMAT=A7 ,ACTUAL=A7 ,$

APP FILEDEF COLORDATA DISK colordata.ftm
-RUN

-* Red, White, and Blue
-WRITE COLORDATA Rood
-WRITE COLORDATA Wit
-WRITE COLORDATA Blauw
-RUN

-* using http://forums.informationbuild...71057331/m/794109794
TABLE FILE TESTDATA
PRINT COLOR
GROEP
COMPUTE DUMMY1/A1 = '';
ON TABLE HOLD AS H001 FORMAT FOCUS INDEX DUMMY1
END
-RUN

TABLE FILE COLORDATA
PRINT COLOR
COMPUTE DUMMY1/A1 = '';
ON TABLE HOLD AS H002 FORMAT FOCUS INDEX DUMMY1
END
-RUN

JOIN DUMMY1 IN H001 TO ALL DUMMY1 IN H002 AS J1

TABLE FILE H001
PRINT DST.H002.COLOR
DST.GROEP
COMPUTE MEASURE/I4 = 0;
BY H002.COLOR
BY GROEP
ON TABLE HOLD AS BASE FORMAT FOCUS
END

-*TABLE FILE BASE
-*PRINT *
-*END


MATCH FILE TESTDATA
SUM MEASURE
BY GROEP
BY COLOR
RUN
FILE BASE
SUM MEASURE
BY GROEP
BY COLOR
AFTER MATCH HOLD AS MATCHDATA OLD-OR-NEW
END

-*TABLE FILE MATCHDATA
-*PRINT *
-*END

-* Order color for use in a chart (spaces do affect the order, but are not visible in the ToolTip)
TABLE FILE MATCHDATA
PRINT MEASURE
GROEP
BY COMPUTE KLEUR/A7 = IF COLOR EQ 'Rood' THEN ' Rood' ELSE IF COLOR EQ 'Wit' THEN ' Wit' ELSE 'Blauw';
ON TABLE HOLD AS INTERIM
END

TABLE FILE INTERIM
SUM INTERIM.INTERIM.MEASURE
BY INTERIM.INTERIM.KLEUR
ACROSS INTERIM.INTERIM.GROEP
END

-EXIT


WebFOCUS 8.0.0.8, Windows 7
 
Posts: 36 | Location: Portland, OR (USA) | Registered: October 11, 2012Report 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     [SOLVED] Assign color based on series value in graphs

Copyright © 1996-2020 Information Builders