I am building the data for a Gantt chart at runtime.
This includes retrieving a long description string that I am setting for the Label.
Short of writing my own "\r\n" inserter to manually break the long desrciption string up, what can I do?
I have not found any tooltip attributes to help me...
Unfortunately, there's no automatic wrapping for the tooltip. I recommend using a custom label renderer to insert line breaks. The code in ToString below will fire once for each of the data points tooltips. Whatever you return in that method will be displayed as the tooltip on the screen.
protected void Page_Load(object sender, EventArgs e){ Hashtable labelHash = new Hashtable(); labelHash.Add("CUSTOM", new LabelRenderer()); chart.LabelHash = labelHash;
chart.Tooltips.FormatString = "<CUSTOM>";}
public class LabelRenderer : IRenderLabel{ public string ToString(Hashtable context) { string myLabel = GetMyLabel(); return myLabel; }}
By the way,
I did have to write my own 'word wrap' method - since the tooltip that gets drawn turns out to be much wider than the browser window.
It would be great (enhancement request) to have the ability to set an attribute on tooltips to auto-wrap content in order to intelligently size the box to fit in the users browser.
But brute-force is 'working' for me at this point.