tenox7 / ttyplot

a realtime plotting utility for terminal/console with data input from stdin
Apache License 2.0
961 stars 43 forks source link

Keep track of how many values got read #51

Closed dadav closed 3 years ago

dadav commented 3 years ago

By limiting the loop to the number of read values the min/max/avg values will be corretly calculated. The problem was that this loop takes the width (e.g. value 135) and loops over the given values (most of them will be 0 in the first iterations). The effect was that the min and avg values were 0 most of the time (until enough values were collected).

Fixes #50

tenox7 commented 3 years ago

nice thank you! let me look at it and test

luckman212 commented 3 years ago

@dadav Thanks for this helpful fix! I noticed this behavior too (had to wait for a full screen width of values to be shown before Avg values are correct). Looking forward to the merge. 👀

tenox7 commented 3 years ago

Thanks a lot!