Pre loader

Hit-Test with IRenderableSeriesViewModel

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

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

Version
V8
  • You must to post comments
0
0

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

  • You must to post comments
0
0

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

  • You must to post comments
0
0

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?

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.