termgraph icon indicating copy to clipboard operation
termgraph copied to clipboard

Progressive Graph on Reading Each Data

Open monsieurDuke opened this issue 3 years ago • 0 comments

Hey there. So I was wondering if there are some way to make the graph become progressive, since it reads new data on the new next line in a file. Here is my snippet on the Bash script.

#!/bin/bash
while IFS= read -r each_stat; do
  echo "$each_stat" > "log/each_result.csv" & wait
  termgraph "log/each_result.csv" --color {cyan,red,yellow,green}; sleep 0.01s
  printf "\033[6A ";
done < "log/result.csv"

First I passed each line of the file to a temp file, so termgraph can read only one data at a time. then I return the cursor 6 line before and continue to read the next data. But its not updating the bar quite what I wanted to, which become overlapped with the previous bar. Are there any solution to overwrite the previous one, without clearing the screen ?

Thanks for the opportunity, really cool stuff !

image image image

monsieurDuke avatar Sep 09 '21 06:09 monsieurDuke