Hi folks,
I’m using MVVM and need to implement hit tests. I found this post from nine years ago, saying it’s not yet implemented:
https://www.scichart.com/questions/wpf/hit-testing-a-renderableseriesviewmodel
Surely you have a solution by now? What is it?
Thanks,
–George
- yefchak asked 3 months ago
- You must login to post comments
Hi George,
Thank you for contacting us.
The recommended way to implement a Hit-Test for the Renderable Series ViewModel is to use our ChartModifiers API. With its help, you can create a custom ChartModifier and hit-test a RenderableSeries there.
Please see the “Determining if Mouse Event occurred over an Axis or main chart surface” section of the following documentation article for more details:
SciChart WPF Documentation – Custom Modifiers – ChartModifierBase API _ WPF Chart Documentation
Unfortunately, the code sample is slightly outdated here because in the latest SciChart versions RenderableSeries API doesn’t expose the HitTest(..) method but a HitTestProvider object. Please have a look:
SciChart WPF Documentation – RenderableSeries APIs – Hit Testing | WPF Chart Documentation
Please try this out and let us know if you need any further assistance.
Kind regards,
Lex S., MSEE
SciChart Technical Support Engineer
- Lex answered 3 months ago
- You must login to post comments
Hi,
Unfortunately, this isn’t working yet. Your examples for the HitTest API make use of the MouseLeftButtonUp event, which passes an argument, e, of type MouseButtonEventsArgs. You use the e.GetPosition() function to adjust the mouse position to chart coordinates.
But in the chart modifier approach which must be used for RenderableSeriesViewModel, you rely on the OnModifierMouseDown function which gets an argument of type ModifierMouseArgs instead of MouseButtonEventsArgs. So I don’t know how to adjust the coordinates as required. I have tried the following, but this doesn’t quite work either:
MouseDownPoint = GetPointsRelativeTo(e.MousePoint, ModifierSurface);
–George
- yefchak answered 3 months ago
- You must login to post comments
Oops, I was wrong. Apparently calling GetPointsRelativeTo() is the required step. Can you give some guidance as to what is the best object to pass as the IHitTestable argument?
- yefchak answered 3 months ago
- You must login to post comments
Please login first to submit.

