I plotted composite chart with multiple layers. I created a legend object and added to the ultrachart.Composite.Legends.Add(....).
What ever the layer I created I added the same to this legend object.
Now when I place the mouse over any of the legend item, it should show in a tool tip with some explanation.
This explanation text is different for different legend item entry.
In the FillSceneGraph event, I did as follows:
int row = 0;
{
Text textPrimitive = e.SceneGraph[e.SceneGraph.IndexOf(p)-1] as Text; //Index0f(p) is legend symboul
//and immediate before (IndexOf(p-1)) is its corresponding text
Infragistics.Win.ToolTip toolTip = new Infragistics.Win.ToolTip(ultrachart1);
//currentMousePoint was a private field which was assigned in the mouse move event of the ultrachart
currentMousePoint.Y >= textPrimitive.bounds.Top && currentMousePoint.Y <= textPrimitive.bounds.Bottom)
toolTip.Show();
}
else
if(null != toolTip)
toolTip.Hide();
I cant assign cappabilities of this text to Pcaps.HitTest and Pcaps.ToolTip and changing the ultrachart1.ToolTips.formatstring = "<ITEM_LABEL>"
as I already used a custom tooltip for the ultrachart to customize the the chart data being showed. If I do so it was showing the same tooltip
for the series data and legends as well. This was a disaster.
Now the problem I have been facing is:
This custom tooltip was working only if there is one entry in the legends item (say only one layer with one XYSeries). I want this cutom tooltip I created for every legend item in the legends box of this composite chart with multiple layers and multiple XYSeries.
I could not loop over through all the legend items text in the FillSceneGraphEvent. Else my work would be easy. But not able to loop through those legend texts
How to this. Any idea? Or else any easy way you suggest to bypass this tricky procedure
Hi David,
Thanks for the idea you suggested. But the chart event and tooltip (done by setting the box capabilbity to hittest and tooltip) share the same tooltip of the chart's. Since my chart's tooltip was cutom and had its own tooltip format string, I was fenced to use the same tooltip ( as I need to again customize the formatstring to serve my legends labels) . The reason was once I change the format string for this common tooltip, the format string for the chart's tooltip changes as well and no more it was showing the chartData.
But I was thankful to you as I got some clue to crack this problem
I looped through all the primitives, checked for the path ends with "legend" and instantiated a seperate Windows ToolsTip on mouse move over that legend item
I tracked externally the mouse move point in seperate mouse move event over this chart control
When this tooltip displayed I broke from the loop!! My purpose solved.
I should be avoiding this tricky procedure had been there a separate tooltip provided for legends (composite chart) exclusively
you couldn't loopthrough the legend Text primitives in FillSceneGraph? why not? don't they show up in e.SceneGraph where p.Path contains "Legend" ?
the one other approach i can think of is using FillSceneGraph to overlay Box primitives on top of the Texts, and make them clickable using
mybox.Layer = e.ChartCore.GetChartLayer();
mybox.Row = mybox.Column = 0;
mybox.Caps = PCaps.HitTest | PCaps.ToolTip;
mybox.Chart = this.ultraChart1.ChartType;
(this way the custom Box primitives will show tooltips and raise the DataItemOver/ChartDataClicked events)