I can't find a direct way to wrap labels within the graphbuilder platform. One trick is to use linefeeds in the label names, i.e. in the table cell content.
I tried to automate that with jsl and it seem to work. But the graph still looks quite disproportionate because the width of the axis box does not change with width of the label and I haven't found a way that works to do that (manually or by script). See script and result below.
//Example table
dt =New Table( "example.jmp",
Add Rows( 3 ),
New Column( "Label", Character, Nominal,
Set Values(
{"This is a very long label that I wish could be wrapped", "Somewhat too long label",
"A perfect label"}
)
),
New Column( "Data", Numeric, Continuous, Format( "Best", 12 ), Set Values( [5, 8, 2] ) )
);
// Example graph
gb = Graph Builder( Variables( Y( :Label ), X( :Data ) ), Elements( Bar( X, Y ) ) );
wrap = 15; // Select desired witdth
// Insert linefeeds at not too close spaces
col = Column( dt, "Label" );
nextspace = expr(ns=Munger( col[], wrap * n, " " ));
nextspace;
For Each Row(
n = 1;
nextspace;
While( ns >= wrap,
col[] = Munger( col[], wrap * n, " ", "\!n" );
n++;
nextspace;
);
);
// Decrease axisbox width
Report( gb )[AxisBox( 2 )] << set width( 30 ); //Does not work!