Hi All,
I’ve got a class that derives from the DataPointSelectionModifier in order to access the OnValueChanged() functionality and everything is fine (Thank you Andrew).
However – When I have 2 series on the chart (scatter series) and 2 points are quite close together, a single selection of a point can result in the selection of two points. On playing around with it a bit I notice that a point can be selected when the mouse pointer is slightly outside the limits of the pointmarker (in this case a 10×10 EllipsePointMarker) so if you get 2 points only a few pixels apart it is possible to place the mouse between the two and get both points selected. You can also see the behaviour in the SciChart examples 2DCharts|Toltips and Hit Test| Pointmarkers Selection example if you play with the points in the top left corner.
The Question: Is there a way to reduce the area around the mouse pointer that a hit test is detected in? (e.g. 20 pixel radius down to say 5 pixel radius)
I’ve had a look at overriding GeometryHitTestResult HitTestCore but I don’t really know if this is even the right way to go. If somebody can confirm this is where I should be looking then I’ll find some time to persevere with it.
Thanks in advance
/Stuart
- Stuart McCullough asked 6 years ago
- You must login to post comments
Hi Stuart,
Short answer, no, the HitTest Radius is fixed for the DataPointSelectionModifier and dependent on series type.
You might be able to change it by overriding this method on DataPointSelectionModifier. Please note this code is untested
public class DataPointSelectionModifierEx : DataPointSelectionModifier
{
protected override IEnumerable<SeriesInfo> GetSeriesInfoAt(Point point)
{
if (ParentSurface != null && !ParentSurface.RenderableSeries.IsNullOrEmpty())
{
foreach (var renderableSeries in ParentSurface.RenderableSeries)
{
if (IsSeriesValid(renderableSeries))
{
const bool interpolate = false;
const double radius = 10;
var hitTestInfo = renderableSeries.HitTest(point, radius, interpolate);
if (IsHitPointValid(hitTestInfo))
{
var seriesInfo = renderableSeries.GetSeriesInfo(hitTestInfo);
yield return seriesInfo;
}
}
}
}
}
}
Best regards,
Andrew
- Andrew Burnett-Thompson answered 6 years ago
-
Hi Andrew, As usual above and beyond – thank you very much for your response. I would never have though to try it this way and your “untested” code worked as is – wish mine did a bit more often lol Anyway – thanks again /Stuart
-
Hah you get used to coding without a debugger when you handle as many support issues as I do :D Glad it did the trick and very happy to be of service!
- You must login to post comments
Please login first to submit.