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] Change Legend Text

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Change Legend Text
 Login/Join
 
Master
posted
I've been playing with Tooltips to see how far I can go with it and I've found some cool tips.. However, on the favorite one, it changes my legends and I'm hoping there is a way to substr my legends like I can with datatext or tooltips..

I know this callback doesn't work, but if there is something like it I'm unable to find it.

Anyone ever have to do something like this?

legend: {
	visible:true,
	formatCallback: function(d, s)
	{
		var str = this.getSeries(s).label;
		var res = str.split(": ");
		return res[2];
	}
},



This is why:

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
I'd be interested in seeing the complete code. Also, I'm not sure what you'd like to do - things look pretty good.


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
Master
posted Hide Post
Enjoy

ENGINE INT CACHE SET ON

-*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 PIEMULTI
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, $
*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);
setDisplay(getLegendArea(),false);
*END
*GRAPH_JS
legend: {
	visible:true,
	formatCallback: function(d, s)
	{
		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',
			tooltip: function(d, s, g)
			{
				var str = this.getSeries(s).label;
				var res = str.split(": ");

				var totalColor = '';
				var totalColorClose = '';

				var sum = pv.sum(this.data[g], function(el){return el;});

		  		if (typeof d === 'object' && d.hasOwnProperty('value'))
		    		d = d.value;


				if(!sum)
					sum = d;

				if(d<10000)
				{
					totalColor = '<font color=\'red\'>[b]';
					totalColorClose = '[/b]</font>';
				}
				else if(d>30000)
				{
					totalColor = '<font color=\'blue\'>[b]';
					totalColorClose = '[/b]</font>';
				}

				var tabData = '<table style=\'border: 1px dotted blue\'>';
				tabData += '<tr><td style=\'\'><b>Country:</b></td><td style=\'\'>' + res[0] + '</td></tr>';
				tabData += '<tr><td style=\'\'><b>Car:</b></td><td style=\'\'>' + res[1] + '</td></tr>';
				tabData += '<tr><td style=\'\'><b>Model:</b></td><td style=\'\'>' + res[2] + '</td></tr>';
				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=\'\'>' + this.formatNumber(d / sum,'#.##%') + ' in ' + this.groupLabels[g] + '</td></tr>';
				//tabData += '<tr><td style=\'\'><b>Series Label:</b></td><td style=\'\'>' + this.getSeries(s).label + '</td></tr>';
				tabData += '</table>';
				return tabData;
			}
		},
]
*END
ENDSTYLE
END

-RUN

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
Master
posted Hide Post
I'm only wanting to display the Model in the legend, but I need the consolidation of all of it for the tooltip. This is why I'm looking for a way to substring out the series label for the legend alone.



- 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
Gavin,

Thanks for posting the code. Very creative! I was wondering if the JavaScript portion of JS Charts is documented somewhere - "Creating HTML5 Charts With WebFOCUS Language 8.0.08" (wfjschart.pdf) does not have anything on JavaScript, just the JSON styling. Are you using http://files.threedgraphics.com/tdgchart/index.html ?


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
Master
posted Hide Post
Truthfully, I'm doing a lot of guessing.. I have an extensive JS background going back to the Mid 90's when it was introduced. I'm taking keywords I find for other things within IBI and play with them to until something does something. I've not found any documentation on WebFOCUS properties in JS. I've asked for it from our reps and they said they would look, but still have never found anything.

No, I've not used threedgraphics, but I have done some D3 (http://d3js.org) within and outside of WebFOCUS.



- 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
It appears that WebFOCUS JS Charts uses Three D Graphics Chart library (View source and you will see reference to "/ibi_apps/tdg/jschart/distribution/tdgchart-min.js"). http://files.threedgraphics.com/tdgchart/index.html points to the documentation. http://files.threedgraphics.com/ points to a bunch of files for our perusal!


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
Master
posted Hide Post
Interesting link.. I'll have to dig around in it for a bit to see if I can steal any ideas.. Smiler

Thanks for the link.



- 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     [CLOSED] Change Legend Text

Copyright © 1996-2020 Information Builders