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     [SHARING] Tips/Tricks - Headers, Footers, Legends, ToolTips

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SHARING] Tips/Tricks - Headers, Footers, Legends, ToolTips
 Login/Join
 
Master
posted
I've ran across a few things the last few days while just playing with things.. I thought I would share.

See something on this pic you like and want to know how?


Here is the code:
ENGINE INT CACHE SET ON
-*These can be data defined or conditional
-DEFAULT &MARKER_DEFAULT = 7;
-DEFAULT &MARKER_SHAPE2 = 2;
-DEFAULT &MARKER_SHAPE5 = 9;
-DEFAULT &MARKER_SHAPE8 = 13;

-*COMPONENT=Define_CAR
DEFINE FILE CAR
 PIEDATA/A250=COUNTRY || ': ' | CAR || ': ' | MODEL;
 VALSALES/I12=10000;
END

-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';

-DEFAULTH &WF_TITLE='Setting Custom Tooltips';

GRAPH FILE CAR
SUM CAR.BODY.SALES AS 'Sales By Model'
BY CAR.CARREC.PIEDATA AS '<MODEL'
WHERE CAR.BODY.SALES GT 0;
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET ARGRAPHENGIN JSCHART
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH PIERING
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
setPieFeelerTextDisplay(0);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=REPORT, OBJECT=LEGEND, LEGEND-VIEW=FLAT,$
*GRAPH_SCRIPT
-*setUserToolTip("Object Name:[ON]<br>Object ID:[OID]<br>Object Instance:[OIN]<br>Object Description:[OD]<br>Series Label:[SL]<br>Group Label:[GL]<br>X Value:[XV]<br>Y Value:[YV]<br>Z Value:[ZV]");
setReportParsingErrors(false);
setSelectionEnableMove(false);

-*PIE Ring Lable
setFontSizeAbsolute(getPieRingLabel(),true);
setAutofit(getPieRingLabel(),false);
setFontSizeInPoints(getPieRingLabel(),20);

-*Change Shapes of Legend
setUseSeriesShapes(true);
setMarkerShape(getAllSeries(),&MARKER_DEFAULT);
setMarkerShape(getSeries(2),&MARKER_SHAPE2);
setMarkerShape(getSeries(5),&MARKER_SHAPE5);
setMarkerShape(getSeries(8),&MARKER_SHAPE8);
*END
*GRAPH_JS
pieProperties: {
	label:
	{
		visible: true,
		color: "#FF0000",
		font: "20pt Segoe UI",
	},
	holeSize: "50%",
},
title: {
	visible:true,
	text: '<font size=2 color=red>C</font>a<font size=2 color=red>r</font>s <font size=5 color=red>S</font>ol<font size=5 color=red>d</font>',
	font: 'bold 16pt Comic Sans MS',
	color:'rgb(0,101,163)',
},
subtitle: {
	visible: true,
	text: 'By <font size=5 color=blue>M</font>odel',
	font: 'bold 14pt Monotype Corsiva',
	color: 'red',
},
legend: {
	visible:true,
	backgroundcolor: '#FFFFCC',
    shadow: true,
	markerSize: 10,
	-*top, bottom, left, right, free
	-*position: 'right',
	position: 'free',
	xy: {x:200, y:200},
	lineStyle: {
		width: 1,
		color: '#000000'
	},
	labels: {
		color: 'blue',
		font: '8pt Verdana'
	},
	title: {
		visible: true,
		text: 'Legend Title',
		font: '10pt Sans-Serif',
		color: 'red',
	},
	formatThis: function(s)
	{
		alert('here');
		var str = this.getSeries(s).label;
		var res = str.split(": ");
		return res[2];
	},
},
htmlToolTip: {
	enabled: true,
-*    snap: true,
    style: {
		border: 'solid black',
		background: '#99FFCC',
	},
},
series: [
		{
		 	series: 'reset',
			pattern: 6,
			tooltip: function(d, s, g)
			{
				var allTitles = 'Country,Car,Model';
				var totalColor = '';
				var totalColorClose = '';

				//get raw series label
				var str = this.getSeries(s).label;
				//create an array from the series label.
				var res = str.split(": ");
				var titles = allTitles.split(",");
				var total=0;

				//NOTE: == 8.0.xx code =============
				//get the total of all groups.
				//pv.sum works only for 8.0.xx and prior..
				//==================================
				//total = pv.sum(this.data[g], function(el){return el;});
				//========= EO 8.0.xx code =========

				//NOTE: == 8.1.xx code =============
				//get the total of all groups.
				//This below only works for 8.1.xx and up..
				//==================================
				var valueArr = this.data[0];
				for (var i=0 ;i<valueArr.length;i++) {
					total+=valueArr[i].value;
				}
				//========= EO 8.1.xx code =========

				//validate object and get the value in return.
				if (typeof d === 'object' && d.hasOwnProperty('value'))
					d = d.value;

				var sum = d / total * 100 ;

				//this was done for some charts, show NaN because of no groups.. This forces them to be 100%
				if(!sum)
					sum = d;

				//if data value is under 10000, then turn red.
				if(d<10000)
				{
					totalColor = '<font color=\'red\'>[b]';
					totalColorClose = '[/b]</font>';
				}
				//if data value is above 30000, then turn blue.
				else if(d>30000)
				{
					totalColor = '<font color=\'blue\'>[b]';
					totalColorClose = '[/b]</font>';
				}

				//build the look of the ToolTip
				var tabData = '<table style=\'border: 1px dotted blue\'>';

				for(var i = 0; i < res.length; i++)
					tabData += '<tr><td style=\'\'>[b]' + titles[i] + ':[/b]</td><td style=\'\'>' + res[i] + '</td></tr>';

				//this.getGroupLabel(g) - Other way to get group label when this.groupLabels[g] isn't working.

				tabData += '<tr><td style=\'\'>[b]Total:[/b]</td><td style=\'\'>' + totalColor + '$' + this.formatNumber(d, '#,#') + ' in ' + this.groupLabels[g] + totalColorClose + '</td></tr>';
				tabData += '<tr><td style=\'\'>[b]Percentage:[/b]</td><td style=\'\'>' + sum.toFixed(2) + '% in ' + this.groupLabels[g] + '</td></tr>';
				tabData += '</table>';
				return tabData;
			}
		},
]
*END
ENDSTYLE
END

-RUN


Edit 1/9/17: moved image from tinypic as it's blocked by most big companies, including my own.

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



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Report This Post
Expert
posted Hide Post
Interesting.

Good One


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Master
posted Hide Post
Thats some good stuff Gavin, thanks for sharing!


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Member
posted Hide Post
Do you perhaps know how to change the total number that appears in the center? I have a desire to change the number format from 208K to $208,###. I have found this syntax on the Graphics manual, but I can't seem to get it to work.

 setPieRingTotalFormatPattern("$###,###"); 


Any ideas?


WebFOCUS 8105
Windows, All Outputs
 
Posts: 22 | Registered: May 14, 2015Report This Post
<nick z>
posted
Hi Chad,
Try this instead:
  
setTextFormatPreset(getPieRingLabel(),-1);
setTextFormatPattern(getPieRingLabel(),"$###,###");
 
Report This Post
Member
posted Hide Post
Thanks Nick! That worked.


WebFOCUS 8105
Windows, All Outputs
 
Posts: 22 | Registered: May 14, 2015Report This Post
Silver Member
posted Hide Post
Chad, Do you mind sharing the code please?
I have the same issue like you
"I have a desire to change the number format from 208K to $208,###" and even after adding the code suggested by NICK I have no luck.

Thanks.
Dayakar.


Prod: WebFOCUS 8.1.05 on Win 10
Test: WebFOCUS 8.1.05 on Win 10
 
Posts: 43 | Registered: January 18, 2007Report This Post
Master
posted Hide Post
Have you reset the format first?
setTextFormatPreset(getPieRingLabel(),-1);



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Report This Post
Silver Member
posted Hide Post
Yes Gavin, I did.


Prod: WebFOCUS 8.1.05 on Win 10
Test: WebFOCUS 8.1.05 on Win 10
 
Posts: 43 | Registered: January 18, 2007Report This Post
Member
posted Hide Post
Dreddy_23,

Here is the section of my code that does my formatting.

 ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 1
ON GRAPH SET GRXAXIS 0
ON GRAPH SET LOOKGRAPH PIERING
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
setPieFeelerTextDisplay(1);
setTextFormatPreset(getPieRingLabel(),-1);
setTextFormatPattern(getPieRingLabel(),"$###,###");
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
*END
*GRAPH_JS
-*The holeSize property of a % will maintain the pie radius proportion no matter what size your chart is. This is better than using a fixed number of pixels
pieProperties: {
holeSize: '60%', label: {visible: true,	font: '10pt Arial',	color: '#666666'},
},
*END
ENDSTYLE
END
-RUN 


WebFOCUS 8105
Windows, All Outputs
 
Posts: 22 | Registered: May 14, 2015Report This Post
Platinum Member
posted Hide Post
Hi,
very useful information.
Is there a way to change the FONT Size and text for the "TOTAL" in the center.

Thanks,


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Master
posted Hide Post
Well, I would of thought it was part of the following, but I'm unable to change it, so maybe it's bugged. This lets me change the color, but not the size.

setFontSizeAbsolute(getPieRingLabel(),true);
setAutofit(getPieRingLabel(),false);
setFontStyle(getPieRingLabel(),2);
setFillColor(getPieRingLabel(),new Color(128,128,128));
setFontSizeInPoints(getPieRingLabel(),18);
setPlaceResize(getPieRingLabel(),0);



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Report 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     [SHARING] Tips/Tricks - Headers, Footers, Legends, ToolTips

Copyright © 1996-2020 Information Builders