Mouseover Series Labels

2 posts, 0 answers
  1. Numaan
    Numaan avatar
    1 posts
    Member since:
    Jan 2011

    Posted 28 Jun 2011 Link to this post

    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.
  2. Evgenia
    Evgenia avatar
    1437 posts

    Posted 03 Jul 2011 Link to this post

    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
Back to Top