I have a bar chart where the label text can be very long. Word wrapping this not satisfactory as a previous post indicated, so I have to clip the text. I'd like tooltips for the labels to show the complete label text, while keeping the tooltips on the bars showing the actual data value.
My reading here suggests that the chart control itself can't do multiple tooltip values??
Can I use the UltraWinToolTip control for this? This means I need a method which will identify the chart primitive under the mouse at any time (say within a mouseMove event) - how do I do this?
You can use chart's DataItemOver and DataItemOut events for this.In DataItemOver, e.Primitive is the primitive under the mouse. You can display its value in the tooltip control. In DataItemOut, clear the tooltip control's tooltip.
DataItemOver and DataItemOut only respond when the mouse is over a Data Point - NOT a Label , which is what I wanted - I need a separate tooltip to occur when the mouse is over the (Row Series) Y axis label.
It looks like I'm stuck with the basic MouseMove...etc events, which means I have to translate mouse co-ords into Chart elements, primitives or whatever (so I can ID the specific Label..etc under the mouse). How do I do this?
Looks like there's no way to tell x axis labels from y axis labels, although, I believe that in the past they had different Path settings. Not sure why this changed, but it's something we'll have to look into. Typically y axis labels would have their Path set to "Border.Title.Grid.Y" and so on.
If you want to handle word wrapping yourself, you can, but it can be a little tricky. You can implement IRenderLabel. There are multiple examples of using IRenderLabel on these forums and in the NA help: http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Chart_Customize_Labels_Using_the_IRenderLabel_Interface.html
You can gather information about the axis labels in FillSceneGraph, which will fire before IRenderLabel.ToString(). In IRenderLabel.ToString() method, you can insert new line characters or modify the text string in any way you choose. Hopefully, this will help you in creating a workaround for the auto-wrapping problem.
Thanks, that did the trick.
One final question. In my horizontal bar chart - its only the Y axis labels I want the tooltips for. I can easily distinguish betwen the two in the DataitemOver event because the X axis label text has a "%" in the text - but is there a more general way to determine this - I couldnt' see one from a cursory examination of the objects exposed in debug?
In reply to an earlier posting about isng the newLine character - these labels are drawn from user definied categories, and aside from a max length on the field itself I have no control over how long a description is entered (the longer ones work fine in printed reports and on grids or combo pick lists), nor can I arbitraily insert newline chars. IAC, the wordwrapping problem is how the chart control currently draws them (incorrectly).
Sorry, I misread the original post. You can make the labels participate in DataItemOver/Out events if you do the following in the FillSceneGraph event:
foreach (Primitive p in e.SceneGraph){ Text label = p as Text; if (label != null) { label.Caps = PCaps.HitTest | PCaps.Tooltip; label.Row = label.Column = 0; }}
Once DataItemOver hits, you should be able to cast e.Primitive as Infragistics.UltraChart.Core.Primitives.Text and use GetTextString() method to get the full unclipped text string.