Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
755
Is there a way to trap the MouseHover event when the mouse is over a DataPoint of the series?
posted

Hi,

I have a column chart and I would like to display information about the column pointed by the mouse.  I dont want to use the tooltip, its position changes all the time and its disturbing.  I want to put a TextBlock in my window that will act as a tooltip but the position will remain.

I would also like to change the look of the column when the cursor is over it.  Ex : change the DataPointColor property or show the marker only when the mouse is over the column.

I cannot find the MousHover event.

 

(you can see an example of what I would like to do here)

http://ca.finance.yahoo.com/charts?s=%5EGSPTSE#chart6:symbol=^gsptse;range=3m;indicator=volume;charttype=line;crosshair=on;ohlcvalues=0;logscale=on;source=undefined

Thanks

Karine

  • 9836
    Suggested Answer
    posted

    Hi Karine,

    You can easily catch the MouseEnterEvent for each DataPoint using the EventManager :

    void Window1_Loaded(object sender, RoutedEventArgs e)
    {
         EventManager.RegisterClassHandler(typeof(DataPoint),DataPoint.MouseEnterEvent,new MouseEventHandler(OnDataPointMouseEnter));
    }

    void OnDataPointMouseEnter(object sender, MouseEventArgs e)
    {
                textBlock.Text = (e.Source as DataPoint).Value.ToString();
    }

    Regards

    Vlad