Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current values at mouse cursor #10

Open
jbrryhooves opened this issue Oct 27, 2020 · 4 comments
Open

Current values at mouse cursor #10

jbrryhooves opened this issue Oct 27, 2020 · 4 comments

Comments

@jbrryhooves
Copy link

First of all, great work on this library - it works a treat.

Is there a way to extract the current values of each of the series at the current mouse cursor? Either by query, or an event to subscribe to?

Thanks

@huww98
Copy link
Owner

huww98 commented Oct 28, 2020

I have implemented this, but currently, no API available.

The nearestPointModel from this line

const nearestPointModel = new NearestPointModel(canvasLayer, this.model, renderOptions, contentBoxDetector);

has a points property, which contains the values of each of the series at the current mouse cursor, and it also has an updated event.

See

pModel.updated.on(() => this.adjustIntersectPoints());
and
const point = this.pModel.points.get(s);
for example usage.

You may need a custom build to expose the nearestPointModel object somehow. In the future, I may add a plugin mechanism.

@jbrryhooves
Copy link
Author

great, thanks very much. I'll have a look at those files and give it a go. From initial look, it looks like it should do what I need.

@citron
Copy link

citron commented Apr 28, 2022

Hello, I need this feature too to be able to tag ECG points. Before digging into the code and try to make an API for it, do you have any news about your own (present or future) implementation?

@huww98
Copy link
Owner

huww98 commented Apr 29, 2022

@citron It is easier with current beta version. See chart.nearestPoint in this page.

You can write a plugin, or just read it from the chart instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants