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
Did you define wraptext? The first post in this thread does this, so i didn't bother doing so in my reply.
Dim wraptext As New WrapTextAxisLabelLayoutBehaviorwraptext.enabled = truewraptext.UseOnlyToPreventCollisions = FalseUltraChart1.Axis.X.Labels.SeriesLabels.Layout.BehaviorCollection.Add(wraptext)UltraChart1.Axis.X.Labels.SeriesLabels.Layout.Behavior = UseCollection
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>
The wrap text behavior typically only breaks on spaces, but I can see how in some cases it can break in the middle of a word. There isn't an option to control how the string breaks up on the behavior, but if you want more control over this, you can implement IRenderLabel and break up the string manually. Here's an example of using IRenderLabel:http://help.infragistics.com/NetAdvantage/WinForms/2010.3/CLR2.0/?page=Chart_Customize_Labels_Using_the_IRenderLabel_Interface.htmlThere should also be plenty of other examples on these forums if you search for "IRenderLabel"
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?
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.