TimeChart icon indicating copy to clipboard operation
TimeChart copied to clipboard

Current values at mouse cursor

Open jbrryhooves opened this issue 5 years ago • 4 comments

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

jbrryhooves avatar Oct 27 '20 21:10 jbrryhooves

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

The nearestPointModel from this line https://github.com/huww98/TimeChart/blob/ca3073ea82b32a45ef046dac6b651cf6ec802bbe/src/index.ts#L82 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 https://github.com/huww98/TimeChart/blob/ca3073ea82b32a45ef046dac6b651cf6ec802bbe/src/nearestPoint.ts#L109 and https://github.com/huww98/TimeChart/blob/ca3073ea82b32a45ef046dac6b651cf6ec802bbe/src/nearestPoint.ts#L125 for example usage.

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

huww98 avatar Oct 28 '20 12:10 huww98

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.

jbrryhooves avatar Nov 01 '20 10:11 jbrryhooves

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?

citron avatar Apr 28 '22 18:04 citron

@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.

huww98 avatar Apr 29 '22 00:04 huww98