I have multiple series on a chart surface, each with their own y-axis. I do not want to display all y-axes as this would take up half the chart surface.
Is there a way to make the matching y-axis only visible when the mouse cursor hovers over a series (hit-test)? How would I go about that?
Thanks
Matt
- bbmat asked 6 years ago
- That sounds very possible, and like a decent solution to having multiple y-axes take up tons of space. I wonder if completely hiding them might be a bad idea, especially if you’d like the user to be able to interact with the axes at all. I haven’t looked into the hit-test stuff too much, but once you get the y-axis you should be able to hide it by setting DrawLabels, DrawMajorTicks, and DrawMinorTicks to false. As a side note, you might get away with just hiding the Axis Titles, they take up about half the size of each axis… I know there’s an answered question about how to do that somewhere on here.
- @Paul, the problem is not the hiding/collapsing of the yAxes. The problem is the binding/linking between a selected series and the Visibility property of the YAxis that is linked via axisID to the renderableseries of the selected series. I preferably want to do that in xaml, only.
- You must login to post comments
Hi Mat
This is impossible in Xaml only. But I appreciate the sentiment of being a Xaml purist 🙂
You are going to have to write a custom ChartModifierBase derived class.
- Override OnModifierMouseMove
- In the mouse move event, iterate over RenderableSeries, call RenderableSeries.HitTest
- The returned HitTestInfo has a property: IsHit. When IsHit is true, set RenderableSeries.YAxis.Visibility=Visible. Set all other RenderableSeries.YAxis.Visibility = Collapsed.
Let me know if this helps
Best regards,
Andrew
- Andrew Burnett-Thompson answered 6 years ago
- @Andrew, awesome, exactly what the doctor prescribed. Thanks a lot.
- You must login to post comments
Please login first to submit.