[CLOSED] Formating data lables on a bar chart(PDF)
I have created a barchart and used Millions as unit on Y axis. I want to display the data labels as $ X.XX ($ symbol and two digits after decimal point). have tried different possible options available in appstudio but couldn't get required format. Please help me.This message has been edited. Last edited by: FP Mod Chuck,
December 31, 2018, 02:15 PM
BabakNYC
I've looked for this specific format but can't find one. You can either do the Millions Currency or 2 decimals. You might want to open a case with IB tech support to see if they have a suggestion and please post it here so we know.
WebFOCUS 8206, Unix, Windows
December 31, 2018, 05:48 PM
Addy
Hi Jarves, have a look at the below code, hope this helps i think setting the following API will help setTextFormatPreset(getY1Label(),10);
ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='INCHES';
-DEFAULTH &WF_STYLE_HEIGHT='4.21875';
-DEFAULTH &WF_STYLE_WIDTH='8.020833';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE ggsales
-* Created by Info Assist for Graph
SUM GGSALES.SALES01.DOLLARS
BY GGSALES.SALES01.PRODUCT
ON GRAPH PCHOLD FORMAT PDF
ON GRAPH SET VZERO 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 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setPlace(true);
setCurveFitEquationDisplay(false);
*END
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTextFormatPreset(getY1Label(),10);
*END
ENDSTYLE
END
-RUN
-*IA_GRAPH_FINISH
WF 8.2.04 Windows/Unix All Formats In Focus since 2006
January 01, 2019, 08:56 PM
Jarves
Hi Addy,
I have tried your suggestion and the dollar symbol is getting added on Y axis units but not on top of the bars. I have tried below. The $ symbol is getting added to he data labels which are on top of the bars but the decimal points are more than two (e.g. $10.65242) setTextFormatPreset(getDataText(),10);
If I use below, I'm able restrict the decimals points but not getting the $ symbol. setTextFormatPattern(getDataText(),"#.##");
January 02, 2019, 06:35 AM
Addy
Hi Jarves, Sorry i just gave you the Y axis string and not the data label but you figured it out. As BabakNYC said that there is no exact setting to what you are asking for and opening a case might help. In the mean time i have written the below code as a work around hope it helps.
ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='INCHES';
-DEFAULTH &WF_STYLE_HEIGHT='4.21875';
-DEFAULTH &WF_STYLE_WIDTH='8.020833';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE ggsales
-* Created by Info Assist for Graph
SUM COMPUTE DOLLAR_M/D12.2= GGSALES.SALES01.DOLLARS /1000000;
BY GGSALES.SALES01.PRODUCT
ON GRAPH PCHOLD FORMAT PDF
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 GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setPlace(true);
setCurveFitEquationDisplay(false);
*END
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getDataText(0), true);
setDataTextDisplay(true);
setTextFormatPreset(getDataText(),-1);
setTextFormatPattern(getDataText(),"$ #.## M");
setTextFormatPreset(getY1Label(),6);
*END
ENDSTYLE
END
WF 8.2.04 Windows/Unix All Formats In Focus since 2006
January 02, 2019, 10:12 AM
Jarves
Hi Addy,
Thanks for the update.
The data labels are showing wrong values. instead of $20.23 M, It is getting displayed as $202345.81 M. Since I have used Millions as unit on Y-axis, the data labels are wrong. I tried to correct it but not succeeded yet.
Thanks, Satish Narina
January 03, 2019, 03:16 AM
Addy
Hi Jarves, In the above example you can see that I have created a Compute column which brings the $ value to Millions with 2 decimals.
Then I am using the pattern to set the data lables. As I said it is a work around.
Thanks
WF 8.2.04 Windows/Unix All Formats In Focus since 2006