Focal Point
[SOLVED]pie graph to display data next to its legend

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8477003386

August 04, 2016, 12:12 PM
NeilWEST
[SOLVED]pie graph to display data next to its legend
Hi All,
I'm new in webfocus. I have this code below to create a pie chart. But I don't know how display the value(group value) next to its legend. do have any Idea? Please help... thanks.

GRAPH FILE MYTABLE
SUM SHIPMENTCOUNT
BY ROUTECOUNTRYNAME
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRWIDTH 0
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 PIE
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
setPieFeelerTextDisplay(1);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT='WebFOCUS Report', $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getLegendArea(),true);
setPieFeelerTextDisplay(0);
setDisplay(getPieLabel(),false);
setPieLabelDisplay(0);
setLegendPosition(2);

*END
ENDSTYLE
END

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8
Windows, All Outputs
August 04, 2016, 01:34 PM
GavinL
Welcome to WF..

First of all, when posting examples, I would suggest trying to reproduce your issue using the CAR or SALES file, so that people can take your code change it, then repost to get the response your looking for. Make it easier on us to help you and not try to translate what you have into a CAR for ourselves to help.

To your issue. By altering the legend, your going to automatically alter the tool tip. This is because the legend comes from the same column that part of your tooltip comes from. So you will need to modify the tooltip so the total doesn't show up twice.

This is how I would do it:

DEFINE FILE CAR
CARSALES/A11=FTOA(CAR.BODY.SALES,'(D9)','A11');
NEWCAR/A255=CAR.COMP.CAR || ' ( ' || CARSALES || ' )';
END

GRAPH FILE CAR
SUM CAR.BODY.SALES
BY NEWCAR
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 GRWIDTH 1
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 1
ON GRAPH SET GRXAXIS 0
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(1);
*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);
setPieFeelerTextDisplay(3);
setLegendPosition(2);
*END
*GRAPH_JS
series: [
	{
		'series': 'reset',
		tooltip: function(d,s,g){ return this.getSeries(s).label; }
	},
],
*END
ENDSTYLE
END
-RUN


Hope that helps



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
August 10, 2016, 01:34 PM
NeilWEST
Thanks a lot. Smiler


WebFOCUS 8
Windows, All Outputs