Focal Point
[CLOSED] Minus Sign Graph Data Text

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

September 29, 2011, 03:36 AM
Tewy
[CLOSED] Minus Sign Graph Data Text
I have a waterfall graph for which negative bars are coloured in red and positive bars in green. The user wants the data text displayed on the graph, but without the minus sign for the negative numbers.

I can get this to work in HTML format on screen, but as soon as I hold the graph the minus sign is back. (I've tried jpeg, png and svg). This is one of several graphs in a compound pdf.

Does anyone know how to get this to work?

Example Graph

  
TABLE FILE CAR
SUM
DEALER_COST 
RETAIL_COST 
COMPUTE MGN/D12.2=RETAIL_COST-DEALER_COST;
COMPUTE MKU/D12.2=(-0.25)*DEALER_COST;
COMPUTE COST/D12.2=DEALER_COST+MKU;
BY CAR
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS TESTDATA FORMAT ALPHA
END
GRAPH FILE TESTDATA
SUM
MKU AS ''
BY CAR AS ''
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET GRAPHSTYLE *
setFontSizeAbsolute(getDataText(),true);
setFontName(getDataText(),"Arial");
setCustomDataText(getDataText(0),false);
setDisplay(getDataText(),true);
setDataTextFormat(-1);
setDataTextFormatPattern("##;##");
setPlaceResize(getDataText(),0);
setFontSize(getDataText(),6);
setFontStyle(getDataText(),0);
setFillColor(getDataText(),new Color(0,0,0));
setPlacePosition(getDataText(),1);
ENDSTYLE
END

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


WF 7.6.11
Output: HTML, PDF, Excel
September 29, 2011, 05:36 PM
Waz
Try this format pattern.

setDataTextFormatPattern("##;(##)");


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!

September 29, 2011, 06:33 PM
Doug
Consider CONPUTEing the MKU as needed BEFORE it goes to the HOLD file. Maybe like this:
COMPUTE MKU2/D12.2=ABS((-0.25)*DEALER_COST);
or some other way...
September 30, 2011, 04:28 AM
Tewy
Waz, when I hold the graph using that format, it reverts to a negative sign again in the picture.

Doug, if I calculate the ABS value the graph won't display properly, it is negative number and needs to be plotted as such. The user (don't you just love them) just wants to display the value without the negative sign but plot it as a negative number.

Thanks for the suggestions.


WF 7.6.11
Output: HTML, PDF, Excel
September 30, 2011, 05:44 AM
atturhari
Here you go

TABLE FILE CAR
SUM
DEALER_COST
RETAIL_COST
COMPUTE MGN/D12.2=RETAIL_COST-DEALER_COST;
COMPUTE MKU/D12.2=(-0.25)*DEALER_COST;
COMPUTE COST/D12.2=DEALER_COST+MKU;
BY CAR
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS TESTDATA FORMAT ALPHA
END
GRAPH FILE TESTDATA
SUM
MKU AS ''
BY CAR AS ''
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET GRAPHSTYLE *
setFontSizeAbsolute(getDataText(),true);
setFontName(getDataText(),"Arial");
setCustomDataText(getDataText(0),false);
setDisplay(getDataText(),true);
setDataTextFormat(-1);
setDataTextFormatPattern("(##);##");
setPlaceResize(getDataText(),0);
setFontSize(getDataText(),6);
setFontStyle(getDataText(),0);
setFillColor(getDataText(),new Color(0,0,0));
setPlacePosition(getDataText(),1);
ENDSTYLE
END


WF 7.7.02 on Windows 7
Teradata
HTML,PDF,EXCEL,AHTML
September 30, 2011, 06:54 AM
<FreSte>
Atturhari,

I modified your example a bit (when you have both positive and negative values, the positive values are shown
between brackets). I changed

setDataTextFormatPattern("(##);##"); in
setDataTextFormatPattern(" ##;##");


... plus now the graph has green and red bars, depending on the values.

TABLE FILE CAR
SUM
DEALER_COST 
RETAIL_COST 
COMPUTE MGN/D12.2=RETAIL_COST-DEALER_COST;
COMPUTE FCTR/D5.2 = IF COUNTRY IN ('JAPAN','ENGLAND') THEN -1 ELSE 1;
COMPUTE MKU/D12.2=FCTR*DEALER_COST;
COMPUTE COST/D12.2=DEALER_COST+MKU;
BY CAR
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS TESTDATA FORMAT ALPHA
END
GRAPH FILE TESTDATA
SUM
MKU AS ''
BY CAR AS ''
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET GRAPHSTYLE *
setDepthRadius(0);
setFontSizeAbsolute(getDataText(),true);
setFontName(getDataText(),"Arial");
setCustomDataText(getDataText(0),false);
setDisplay(getDataText(),true);
setDataTextFormat(-1);
setDataTextFormatPattern(" ##;##");
setPlaceResize(getDataText(),0);
setFontSize(getDataText(),9);
setFontStyle(getDataText(),0);
setFillColor(getDataText(),new Color(0,0,0));
setPlacePosition(getDataText(),1);
ENDSTYLE
ON TABLE SET STYLE *
TYPE=DATA, COLOR=RED, WHEN=MKU LT 0 ,$
TYPE=DATA, COLOR=LIME, WHEN=MKU GE 0 ,$
END

September 30, 2011, 07:00 AM
Tewy
The above codes all work for me when the graph is output to screen.However when I insert the following

 ON GRAPH HOLD AS TEST FORMAT PNG 


and look at the png file generated the values are shown with the minus sign. The same happens when I use JPEG or SVG.

Are you getting the same behaviour when you save the image or is it just me with that issue?


WF 7.6.11
Output: HTML, PDF, Excel
September 30, 2011, 07:11 AM
atturhari
I dont see any issue. I tried SVG format.


WF 7.7.02 on Windows 7
Teradata
HTML,PDF,EXCEL,AHTML
September 30, 2011, 08:24 AM
Tewy
In that case may be its an issue with 765. I can tell the user they'll have to wait until we upgrade to a more recent version


WF 7.6.11
Output: HTML, PDF, Excel