Hi,
Is it possible to get the current YAxisSegment or segment index on chart mouse move event or somewhere?
I have multiple segmented Y axes with 1 point series each and have only one annotation (not for each series or Y axes) in the chart. So I need to find the segment the mouse is over and show the annotation for this point series' point.
I may calculate and find the current mouse over segment with _chart.ViewXY.GetGraphSegmentInfo() parameters but is there a better or easy way to find this?
Thanks.
Getting the current YAxisSegment on mouse move
Moderator: Queue Moderators
-
- Posts: 557
- Joined: Mon Mar 14, 2016 9:22 am
Re: Getting the current YAxisSegment on mouse move
Yes, this approach is good, especially if you want to find segment index.
An alternative to _chart.ViewXY.GetGraphSegmentInfo() method/usage is yAxis.GetGraphSegmentTopAndHeight() method.
With both methods you will get yAxis/segment size in screen pixels(PX). And don't forget that in WPF mouse position is estimated in DIPs. Therefore, you need to do conversion between those units (e.g. with LightningChart class DpiHelper).
All the best.
An alternative to _chart.ViewXY.GetGraphSegmentInfo() method/usage is yAxis.GetGraphSegmentTopAndHeight() method.
With both methods you will get yAxis/segment size in screen pixels(PX). And don't forget that in WPF mouse position is estimated in DIPs. Therefore, you need to do conversion between those units (e.g. with LightningChart class DpiHelper).
All the best.
Re: Getting the current YAxisSegment on mouse move
Great, thank you!