This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, I want to capture the mouseover on a dataelement in a bar- or piechart in order to highlight the according record in a datatable. How can I achieve it? Is it possible to do something via databinding property like :
In a piechart the mouseover was not fired, when I implemented something like that:
Any ideas? |
|
|
Hello There currently isn't a property or event that acquires the data point under the mouse. I've noted this done as a future enhancement, but for now, here is a workaround you could use: Some where in code behind, add a mouse move handler to the chart control in question like this:
And the event handler could look like this:
Whenever the mouse moves over the chart, we start with e.OriginalSource and hack through the visual tree to find an instance of Bar. If an instance of Bar is found, you can use Bar.DataContext to get the raw data of the data point. A similar technique can be used for pie charts where you would look for PieSlice instances. Also, if you were wondering, this workaround doesn't affect performance. I understand this is not very elegant or MVVM friendly, though you could wrap this up into an attached property or a class that extends our Chart control if you wanted to avoid infecting the code behind. Let me know if you have any questions about this. Jason Fauchelle |
|