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     [CLOSED] Cool Tool Tip but how do you use it in a stacked bar chart?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Cool Tool Tip but how do you use it in a stacked bar chart?
 Login/Join
 
Guru
posted
A while back I found this great tool tip graph script code and adapted it to a few charts. Now I have a stacked bar chart and I can't figure out how to get the column total instead of the grand total.

In the code below, within the function, you see the variable "total". This is used to calculate the percentage "d" and then used in the tooltip. The problem is, I need the total to be the total of the month column data. But it appears to be the total for all of the columns of data.

You can see in the screen shot that the tool tip show 14.2% as the percentage but clearly the bar is showing closer to 50%.

Anybody accomplished this?

*GRAPH_JS
"introAnimation": {
 "enabled": false,
 "duration": 1400
},
*END
*GRAPH_JS
"riserBevel": "none",
"introAnimation": {
 "enabled": false,
 "duration": 1400
},
htmlToolTip: {
	enabled: true,
-*    snap: true,
    style: {
		border: '#99FFCC',
		background: '#99FFCC',
	},
},
series: [
{ "series": 'reset',
	"tooltip": function(d,s,g){
	    var valueArr = this.data[0],total=0;
		    for (var i=0 ;i<valueArr.length;i++){total+=valueArr[i];}
                           var sum= d / total * 100 ;
debugger;
return this.getSeries(s).label + " For " +this.getGroupLabel(g)+': '+ this.formatNumber(d, '#,#')+ '<br>'+' Percent of Total ' +this.getSeries(s).label + ': '+sum.toFixed(1)+ "%";
 }
  },
]
*END  

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report This Post
Virtuoso
posted Hide Post
Do not use the default IBI tooltip, build your own.

TABLE FILE CAR
SUM COMPUTE VAR     /P6C   =  RETAIL_COST - DEALER_COST;
    COMPUTE VAR_PCT /P6.2C = (RETAIL_COST - DEALER_COST) / DEALER_COST * 100;
BY COUNTRY
ON TABLE HOLD AS TMP
END
-RUN

ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET HTMLENCODE=ON
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='240.0';
-DEFAULTH &WF_STYLE_WIDTH='460.0';
-DEFAULTH &WF_TITLE = 'WebFOCUS Report';

GRAPH FILE TMP
SUM VAR  AS 'Variance'
    COMPUTE DIMX      /A30V = COUNTRY;
    COMPUTE VARX      /A30V = FPRINT(VAR, 'P6C', 'A10V') || ' $';
    COMPUTE VAR_PCTX  /A20V = LJUST(10, FPRINT(VAR_PCT, 'P6.2C', 'A12V'), 'A10V') || ' %';
BY COUNTRY AS ''

ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=HEADING, JUSTIFY=CENTER, $
TYPE=HEADING, LINE=1, ITEM=1, OBJECT=TEXT, FONT='TIMES NEW ROMAN', SIZE=10, COLOR=RGB(8 97 74), STYLE=NORMAL, $
TYPE=DATA, COLUMN=COUNTRY,  BUCKET=x-axis, $
TYPE=DATA, COLUMN=VAR,      BUCKET=y-axis,  $
TYPE=DATA, COLUMN=DIMX,     BUCKET=tooltip, $
TYPE=DATA, COLUMN=VARX,     BUCKET=tooltip, $
TYPE=DATA, COLUMN=VAR_PCTX, BUCKET=tooltip, $
*GRAPH_JS_FINAL
series: [ {"series": 'reset', "tooltip": '{{tooltip1}}<br>{{tooltip2}}<br>{{tooltip3}}'} ],
htmlToolTip: {enable: true, snap: false }
*END
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getY1Title(),false);
setDisplay(getY1Label(),false);
setDisplay(getY1AxisLine(),false);
setLabelStagger(getO1Label(),true);
setTextRotation(getO1Label(),3);
*END

*GRAPH_JS_FINAL
"xaxis": {
    "title": {"visible": false}
},
"yaxis": {
    "title": {"visible": false},
    "majorGrid": {"ticks": {"visible": false}}
}
*END
ENDSTYLE
END
-RUN


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report 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     [CLOSED] Cool Tool Tip but how do you use it in a stacked bar chart?

Copyright © 1996-2020 Information Builders