I am trying to get the x axis labels to wrap on a column chart (part of a composite chart) and the following does not work:
Dim wraptext As New WrapTextAxisLabelLayoutBehaviorwraptext.enabled = truewraptext.UseOnlyToPreventCollisions = False.AxisX.Labels.Layout.BehaviorCollection.Add(wraptext).AxisX.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.UseCollection
This is the result:
What am I doing wrong?
Thanks,
Dana
Looks like you're using series labels on your chart, so you should be setting the wrap text behavior to the seres labels, instead of item labels:Axis.X.Labels.SeriesLabels.Layout.BehaviorCollection.Add(wraptext)Axis.X.Labels.SeriesLabels.Layout.Behavior = UseCollectionAlso, it wouldn't hurt to set EnableRollback to false on the wrap text behavior itself.
Max,
I'm using the following code but my labels are not wrapping. I tried typing what you had into the vb.net area but it didn't accept "wraptext" as an option to add to the collection. What am I doing wrong?
Bill
<Labels Font="Verdana, 7pt" HorizontalAlign="Near" ItemFormatString="none" Orientation="VerticalLeftFacing" VerticalAlign="Center" Visible="False"> <SeriesLabels Font="Verdana, 12pt, style=Bold" HorizontalAlign="Center" Orientation="Custom" VerticalAlign="Center" OrientationAngle="45"> <Layout Behavior="UseCollection"> <BehaviorCollection> <igchartprop:WrapTextAxisLabelLayoutBehavior UseOnlyToPreventCollisions="False" EnableRollback="False" /> <igchartprop:StaggerAxisLabelLayoutBehavior /> </BehaviorCollection> </Layout> </SeriesLabels> </Labels>
Thanks. That does work if the EnableRollback is set to false AND there is enough axis extent to show the wrapped text.
On a related note, any way to stop it from breaking in the middle of a word? In otherwords, only split on spaces?