Focal Point
[SOLVED]series_percent in pie chart label shows always 2 decimals instead of one

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

January 03, 2020, 04:47 PM
vinodh
[SOLVED]series_percent in pie chart label shows always 2 decimals instead of one
using series_percent in pie chart labels always shows 2 decimals instead of one. i tried using the default label formatting like below and it didnt respect it.

pie chart code:
----------------
setTextFormatPreset(getPieSliceLabel(),3);
.......
.......
.......
series: [
{series: 'reset', dataLabels: {content: '{{&|nbsp;&|nbsp;&|nbsp;&|nbsp;}} {{series_percent}} \n {{series_label}}' } } ]

label always shows like 10.10% though the data is 10.1% and its datatype is P12.1

anyone has idea to control the format in series_percent

-***************************************


update:
----------
currently i am experimenting like below using value instead of series_percent. will update in comments soon.

"series":[{"series": "reset",
"dataLabels":{"content":"{{value | formatNumber('$#,###.00')}}\n({{series_percent}})"}}],

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


WebFOCUS 8
Windows, All Outputs
January 03, 2020, 05:07 PM
vinodh
update:

when i use "value" instead of "series_percent" i couldnt append the value with %. it converts the value to percent.

"series":[{"series": "reset",
"dataLabels":{"content":"{{value | '%'}}"],


WebFOCUS 8
Windows, All Outputs
January 03, 2020, 06:21 PM
Hallway
This works for me
  
GRAPH FILE ibisamp/car
SUM CAR.BODY.SALES
BY CAR.ORIGIN.COUNTRY
ON GRAPH PCHOLD FORMAT JSCHART
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/ibi_themes/endeflt.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=color, $
TYPE=DATA, COLUMN=N2, BUCKET=measure, $
*GRAPH_SCRIPT

setReportParsingErrors(false);
setSelectionEnableMove(false);
setTransparentBorderColor(getSeries(*), true);
setPieLabelDisplay(5);
setTextFormatPreset(getPieSliceLabel(),3);
*GRAPH_JS_FINAL
"pieProperties": {
"holeSize": "0%"
},
"riserBevel": "none",
"agnosticSettings": {
"chartTypeFullName": "Pie_Pie"
}

*END
ENDSTYLE
END

-RUN



Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
January 07, 2020, 10:43 AM
vinodh
@hallway - i made it work this way, as i need some customization in the way the labels are displayed like values first followed by the label whereas webfocus by default doesn't have the functionality.
also i am able to concatenate the percent symbol without using pipe symbol.

i will close the case as below code help me resolve my need.

{series: 'reset', dataLabels: {content: '{{&|nbsp;&|nbsp;&|nbsp;&|nbsp;}} {{value}}% \n {{series_label}}' } } ]


WebFOCUS 8
Windows, All Outputs