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.
Please give advice with the following issue. I have a graph with two lines, one is curve and another is constant. I need to apply a conditional styling, so that if the value of the curve line is greater then the constant it would be colored.
This is what yet i have managed to do, but it is not what needed
TABLE FILE CAR SUM DEALER_COST COMPUTE TEST/D12.2=10000; BY CAR ON TABLE HOLD AS TEMP END -RUN
GRAPH FILE TEMP SUM DEALER_COST TEST BY CAR ON GRAPH PCHOLD FORMAT PNG ON GRAPH SET HTMLENCODE ON ON GRAPH SET GRAPHDEFAULT OFF ON GRAPH SET VZERO OFF ON GRAPH SET HAXIS 1000 ON GRAPH SET VAXIS 500 ON GRAPH SET UNITS PIXELS ON GRAPH SET LOOKGRAPH VLINE ON GRAPH SET GRMERGE ON ON GRAPH SET GRMULTIGRAPH 0 ON GRAPH SET GRLEGEND 0 ON GRAPH SET GRXAXIS 1 ON GRAPH SET STYLE * *GRAPH_SCRIPT setPieDepth(0); setPieTilt(0); setDepthRadius(0); setCurveFitEquationDisplay(false); setPlace(true); setPlaceResize(getFrame(),1);
-*we need to set the size of the rectangle for the legend area setLegendReverse(true); setLegendAutomatic(false); setRect(getLegendArea(),new Rectangle(-11318,1359,32066,3000)); setLegendPosition(4); setPlace(true); -* data labels setDataTextDisplay (true); setRemoveDuplicateDataText(true);
-*set font size for values labels setFontStyle(getDataText(),0); setFontSizeAbsolute(getDataText(),true); setAutofit(getDataText(),false); setFontSizeInPoints(getDataText(),8); setPlaceResize(getDataText(),0);
-*set font size for O1 labels setFontSizeAbsolute(getO1Label(), true); setFontSizeInPoints(getO1Label(), 8); setPlaceResize(getO1Label(), 0); -* setFontSizeAbsolute(getY1Label(), true); setFontSizeInPoints(getY1Label(), 8); setPlaceResize(getY1Label(), 0);
setSeriesLineWidthDefault(2); setDisplay(getY1AxisLine(),true); setDisplay(getY1MajorGrid(),false); -*-*set font size for legend; setFontSizeAbsolute(getLegendText(),true); setAutofit(getLegendText(),false); setFontSizeInPoints(getLegendText(),8); -*setFontSizeInPoints(getLegendText(),5.2); setPlaceResize(getLegendText(),0); *END DEFMACRO=Condition_1, MACTYPE=RULE, WHEN=N2 LT TEST, $ TYPE=DATA, COLUMN=N2, MACRO=Condition_1, COLOR=RGB(255 0 0), $ ENDSTYLE END
This is how the output look like now
This is how it should be
Please give an advice.
Thank you, AntonThis message has been edited. Last edited by: <Kathryn Henning>,
Hi, You can't do this with a Line Chart. There are 2 options that you can use. Option 1. Disconnect Line Markers, which essentially makes it a Scatter chart. And use conditional styling to color markers above your Reference Line.
Option 2. Use Stacked Bar chart. Calculate the difference between your value and the Reference Line.
Here are the examples.. Disconnected Line Markers(Option 1):
GRAPH FILE car
SUM CAR.BODY.DEALER_COST
COMPUTE RefLine/I5=10000 ; NOPRINT
BY CAR.ORIGIN.COUNTRY
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET ARGRAPHENGIN JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
setUseSeriesShapes(true);
setMarkerSizeDefault(50);
*END
DEFMACRO=Condition_1, MACTYPE=RULE, WHEN=N2 GT RefLine, $
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, ORIENTATION=LANDSCAPE, $
TYPE=DATA, COLUMN=N2, MACRO=Condition_1, COLOR=RGB(0 255 0), $
COLUMN=N3, ITEM=1, GRAPH-COMMAND='setReferenceLineValue(getReferenceLineY1(0),$VALUE)', $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setConnectLineMarkers(false);
setSeriesType(1,2);
setReferenceTextPosition(getReferenceLineTextY1(0),0);
setDisplay(getReferenceLineY1(0),true);
setBorderColor(getReferenceLineY1(0),new Color(0,0,0));
setFillColor(getReferenceLineTextY1(0),new Color(0,0,0));
setLineWidth(getReferenceLineY1(0),1);
setBorderColor(getReferenceLineY1(0),new Color(255,128,64));
setFillColor(getReferenceLineY1(0),new Color(255,128,64));
setFillColor(getReferenceLineTextY1(0),new Color(255,128,64));
setLineWidth(getReferenceLineY1(0),3);
setLineBasicStrokeType(getReferenceLineY1(0),0);
setTextString(getReferenceLineTextY1(0),"");
setFillColor(getSeries(0),new Color(255,0,0));
*END
ENDSTYLE
END
-RUN
Stacked BAR Chart(Option 2):
GRAPH FILE car
SUM COMPUTE RefLine/I5=10000 ; NOPRINT
COMPUTE BELOW_RefLine/D12.2=IF CAR.BODY.DEALER_COST GT 10000 THEN 10000 ELSE CAR.BODY.DEALER_COST ;
COMPUTE ABOVE_RefLine/D12.2=IF CAR.BODY.DEALER_COST GE 10000 THEN ( CAR.BODY.DEALER_COST -10000) ELSE 0;
BY CAR.COMP.CAR
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET ARGRAPHENGIN JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
setUseSeriesShapes(true);
setMarkerSizeDefault(50);
*END
COLUMN=N2, ITEM=1, GRAPH-COMMAND='setReferenceLineValue(getReferenceLineY1(0),$VALUE)', $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setReferenceTextPosition(getReferenceLineTextY1(0),0);
setDisplay(getReferenceLineY1(0),true);
setBorderColor(getReferenceLineY1(0),new Color(255,128,64));
setFillColor(getReferenceLineY1(0),new Color(255,128,64));
setFillColor(getReferenceLineTextY1(0),new Color(255,128,64));
setLineWidth(getReferenceLineY1(0),3);
setLineBasicStrokeType(getReferenceLineY1(0),0);
setTextString(getReferenceLineTextY1(0),"");
setFillColor(getSeries(0),new Color(255,0,0));
setFillColor(getSeries(1),new Color(0,255,0));
*END
ENDSTYLE
END
-RUN
Notice that I used Reference Line in both examples.
One thing to remember on this problem is that the charted points are the pertinent data and the lines are purely connectors - they do not relate to the actual data being presented other that serving to provide a visual guide as to the changing of data plots. Therefore it is not possible to partially colour the connecting lines because they have no salient data value - so not really a problem, more a case of mistaking the relevance of the connecting lines.
This would be true of any charting engine and not just JSCHART or PFJ that are used by WebFOCUS.
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, 2004
Unfortunately the code with java scripts causes the script errors. And i suppose it is caused by your system. So i suppose i will have to leave with Nick's solution.
Thank you, AntonThis message has been edited. Last edited by: Anton,
Originally posted by Anton: Unfortunately the code with java scripts causes the script errors. And i suppose it is caused by your system.
What script errors would those be? I copy-pasted Francis' code into a fex and it works just fine. The only "errors" I get are about the fact that the jquery site still uses SHA-1 in their certificate.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :