Hi,
Is there a way to wrap the text in the legend?
Nothing out of the box, but you can implement IRenderLabel to modify the legend items' text.Hashtable labels = new Hashtable();labels.Add("LABELS", new Labels());this.ultraChart1.LabelHash = labels;this.ultraChart1.Legend.FormatString = "<LABELS>";
public class Labels : IRenderLabel{ public string ToString(Hashtable context) { string text = (string)context["ITEM_LABEL"]; if (text.Length > 10) { text=text.Insert(10, "\n"); } return text; }}
Thanks Max, it worked !
here is the vb.net code I used (I added statement for 2 times wraping also):
Dim labels As New Hashtable labels.Add("LABELS", New Labels) Me.UltraChart1.LabelHash = labels Me.UltraChart1.Legend.FormatString = "<LABELS>"
Public Class Labels Implements IRenderLabel Public Overloads Function ToString(ByVal context As System.Collections.Hashtable) As String Implements Infragistics.UltraChart.Resources.IRenderLabel.ToString Dim text As String = CType(context("ITEM_LABEL"), String) If text.Length > 20 Then text = text.Insert(20, System.Environment.NewLine) text = text.Insert(10, System.Environment.NewLine) ElseIf text.Length > 10 Then text = text.Insert(10, System.Environment.NewLine) End If Return text End FunctionEnd Class