This is a migrated thread and some comments may be shown as answers.

Mouseover Series Labels

1 Answer 55 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Numaan
Top achievements
Rank 1
Numaan asked on 28 Jun 2011, 06:38 PM
While mouseovers show tooltips on series' points, I'd like to be able to show the details of the series point in a separate label on the graph somewhere.

How can I attach an event to the line of the graph to show the tooltip/data in the label on mouseover?

Thank you in advance.

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 03 Jul 2011, 10:20 AM
Hi Numaan,

You can handle the ItemToolTipOpening event of the ChartArea and set your Label's Content to the Tooltip's content. To get the X and Y values of the cursor's current position - the ConvertPhysicalUnitsToData method is used:
void ItemToolTipOpening(ItemToolTip2D tooltip, ItemToolTipEventArgs e)
 
   {
     ChartArea chartArea = RadChart1.DefaultView.ChartArea;
 
     Point physical = e.MouseData.GetPosition(RadChart1.DefaultView.ChartArea.ChildrenOfType<ClipPanel>()[0] as Panel);
 
     double x = chartArea.AxisX.ConvertPhysicalUnitsToData(physical.X);
 
     double y = chartArea.AxisY.ConvertPhysicalUnitsToData(physical.Y);
 
     tooltip.Content = string.Format("X: {0:0.0} Y={1:0.0}", x, y);
     label1.Content = tooltip.Content;
   }

For more information about the ItemTooltipOpening event - refer to our help topic.

Best wishes, Evgenia
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Numaan
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or