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

Stop Scrolling But Line Running #149

Open
tomeroto opened this issue Oct 14, 2022 · 2 comments
Open

Stop Scrolling But Line Running #149

tomeroto opened this issue Oct 14, 2022 · 2 comments

Comments

@tomeroto
Copy link

Hi, can smoothie do like "Heart Chart Monitor". I have found example, but I don't know to implement it with smoothie.
Example:
Simple Heart Chart Monitor

So, I need to stop auto scrolling, and let just the line is moving.

Btw, smoothie is great and stable, I love it.

@WofWca
Copy link
Collaborator

WofWca commented Oct 15, 2022

Yes. Although you have to get creative.

I have implemented this in my code (see the jumpPeriodMs > 0 case):
https://github.com/WofWca/jumpcutter/blob/517de1973af1e9ccbe0c9dbc386407fbe940f1e0/src/entry-points/popup/Chart.svelte#L504-L535

Explanation: you want to manually call smoothie.render(canvas, time) with time that increments in jumps the size of the chart length.

@ajamesmiller35
Copy link

I have created a custom version of smoothie in typescript that is capable of rendering charts that are completely still. So if you have a prerecorded data set for example you can just load that into smoothie charts and then pan forward and back at your own pace so you can analyze the data carefully. It also works in realtime and you can switch between the two seamlessly.

From my experience with this I would recommend instead of calling render manually, keep the requestAnimationFrame loop running and just modify nowMillis at the beginning of the render function. Set that to increments the size of the chart length like WofWca suggests.

You could get the current time at the beginning of the render function, set the value of nowMillis from a new property on the Smoothie object (maybe call it 'jumpIntervalTime'. Then check at the beginning of each render if the current time is greater than or equal to the jumpIntervalTime. If it is, then add the correct amount of time to jumpIntervalTime based on the chart length.

The advantage of not calling render manually is that your tooltips will still work. Also, I haven't analyzed WofWca's code closely, but if you are calling render manually at those intervals I am not sure how the line is getting drawn in between.

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