Focal Point
[CLOSED] setTextWrap Not working as expected

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

November 12, 2020, 10:07 AM
srajeevan
[CLOSED] setTextWrap Not working as expected
Hi All,

I have a bar graph in PDF format. The bar graph has three series in the vertical measure.
The X-axis labels are of length 25.Client requires the x-axis to be displayed horizontal(no staggering and angles) below each x-axis item.
So i use
 setTextWrap  
to wrap the x-axis labels.
For some reason the x-axis labels are not wrapping even though i have the setTextWrap set.
Here is the code that i use.
  
setFontSizeAbsolute(getO1Label(), true);
setFontSizeInPoints(getO1Label(), 8);
setTextWrap(getO1Label(),true);
setPlaceResize(getO1Label(), 0);
setFontName(getO1Label(),"CALIBRI");
setDisplay(getO1Label(),true);


Also in the output ,only alternate x-axis labels are displaying. I believe it is because the wrapping is not happening.

I have seen a similar post , but i don't see a solution for the issue in there.

Here is a sample code with CAR file.
  
ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET HTMLENCODE=ON
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
GRAPH FILE car
-* Created by Info Assist for Graph
SUM CAR.BODY.SALES
RETAIL_COST
DEALER_COST
BY CAR.COMP.CAR
ON GRAPH PCHOLD FORMAT PDF
ON GRAPH SET VZERO OFF
ON GRAPH SET UNITS INCHES
ON GRAPH SET HAXIS 8
ON GRAPH SET VAXIS 4
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);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
TYPE=REPORT, PAGESIZE=LETTER, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);

setTextWrap(getO1Label(),true);
setFontSizeAbsolute(getO1Label(), true);
setFontSizeInPoints(getO1Label(), 6);
setPlaceResize(getO1Label(), 0);
setFontName(getO1Label(),"CALIBRI");
setDisplay(getO1Label(),true);

setResizeBarMode(false);
setRiserWidth(10);
setDepthRadius(0);
setRiserBarGroupSpacing(20);

*END
ENDSTYLE
END


Any of you encountered the same issue?

This message has been edited. Last edited by: FP Mod Chuck,


WF8206,Windows 7,8,10
HTM,PDF,EXCEL
November 12, 2020, 04:10 PM
srajeevan
Hi All,

I got some clue into why this is happening.
A per the documentation of setTextWrap, the wrapping occurs when a space character is encountered as quoted below.
quote:

setTextWrap()
This method enables/disables line wrapping for a text object. When text wrapping is enabled, the graphing engine will look for space characters in the text string and draw the text on multiple lines at space character boundaries. When text wrapping is disabled, the text string will always be drawn on a single line.


In the my data, I have 10 x-axis labels and all labels except one starts with 'DemoText, Hello'.
This is the pattern i have in my label. There is a string followed by a comma and a space.
In the bar graph output, the wrapping occurs after the comma when it encounters a space. So the output looks like below,
DemoText,
 Hello  


One particular label is not following the pattern of other labels.
It has 'SomeText anothertext'.Even though there is a space , it is not being used to wrap or it is not wrapping in the first space that it encounters. When i remove this particular entry from the data , all labels wraps perfectly.
I don't understand why it happens that way.

Appreciate any insight into why this is happening.


WF8206,Windows 7,8,10
HTM,PDF,EXCEL