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

CLI: for realtime data stream, clear old graph before plotting new data #44

Open
guptarohit opened this issue Jul 8, 2023 · 0 comments
Labels
CLI enhancement New feature or request good first issue Good for newcomers

Comments

@guptarohit
Copy link
Owner

Currently, when we pass data stream to cli of asciigraph it outputs the graph to stdout by default.

While this works fine in general, it becomes problematic when plotting in realtime mode as terminal retains the previous graph outputs.

To address this, it would be nice to keep only the latest plot copy in the terminal. To achieve it, clear the already plotted graph first before plotting new when we plotting realtime graph from stdin.

Possible solution: we can utilise ANSI escape sequences to move the cursor and clear the old graph. The following snippets might be helpful:

Move cursor n lines up: fmt.Sprintf("\033[%dA", n)
Clear the line: fmt.Sprintf("\033[2K")

@guptarohit guptarohit added enhancement New feature or request good first issue Good for newcomers CLI labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant