asciichart
asciichart copied to clipboard
Graph characters not clearing on row change (asciichartpy)?
I didn't seem to have this problem with a previous version, but since dropping in 1.5.12 (thank you for reimplementing the user specification of characters!), I've got this issue where the graph doesn't clear adjacent rows when it shifts; see screenshot.
When the graph is at its max width and redrawing over a previous graph, it no longer clears these characters when scrolling. I looked at the commit history, and determined this bug is caused by commit e9adb0d, with the addition of the .rstrip()
call; when I edited my init.py and removed .rstrip()
the graph behaves as it used to.
(ignore the colors, that's just an artifact of my HDMI capture device; it's all one color on-screen)
Opened PR #51 for this
@DoktorJ thank you! Will check and merge shortly!
@DoktorJ can you plz post the code you use to reproduce the above graph? Namely, the instantiation/configuration code and the series. It might be caused by a different issue (not related to rstrip(), possibly an encoding issue or something related).
@DoktorJ also, it would help if you could post your result of test.py
(run it from the cloned repo).
@kroitor it's part of a bash loop that monitors system temperature. First the configuration is set up outside the loop, based on detected display parameters to try to maximize graph size and keep the Y-axis intervals clean, instead of weirdly-rounded decimal numbers...
scmin=30
scmax=100
scheight=35
graphcfg='{"min":'$scmin', "max":'$scmax', "height":'$scheight', "format":"{:6.1f} ", '\
'"symbols": ["┼", "┤", "╶", "╴", "─", "└", "┌", "┐", "┘", "│"]}'
and then the loop itself does this:
# code that fetches temperature via `sensors` and appends the value to a bash array variable named tgraph
tgraphstr=$(echo "${tgraph[@]}" | tr ' ' ,)
python -c "import asciichartpy; print(asciichartpy.plot([${tgraphstr}],${graphcfg}));"
I pulled my specific PR and ran test.py, then switched back to master and ran again, also checked the return value just for shiggles:
jess@Jess-N141ZU:~/git/asciichart$ git checkout PULL-51
Switched to branch 'PULL-51'
jess@Jess-N141ZU:~/git/asciichart$ python test.py
7.00 ┼──╮ ╭────╮ ╭─
6.00 ┤ ╰─╮ ╭─╯ ╰─╮ ╭─╯
5.00 ┤ ╰─╮ ╭─╯ ╰─╮ ╭─╯
4.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
3.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
2.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
1.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
0.00 ┼ ╰╮ ╭╯ ╰╮ ╭╯
-1.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-2.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-3.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-4.00 ┤ ╰─╮ ╭─╯ ╰─╮ ╭─╯
-5.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-6.00 ┤ ╰─╮ ╭─╯ ╰─╮ ╭─╯
-7.00 ┤ ╰─────╯ ╰─────╯
2.00 ┼─────────────────────────────────────────────────────────────────────────────────────────
2.00 ┼─────────────────────────────────────────────────────────────────────────────────────────
0.00 ┼─────────────────────────────────────────────────────────────────────────────────────────
0.00 ┼─────────────────────────────────────────────────────────────────────────────────────────
jess@Jess-N141ZU:~/git/asciichart$ echo $?
0
jess@Jess-N141ZU:~/git/asciichart$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
jess@Jess-N141ZU:~/git/asciichart$ python test.py
7.00 ┼──╮ ╭────╮ ╭─
6.00 ┤ ╰─╮ ╭─╯ ╰─╮ ╭─╯
5.00 ┤ ╰─╮ ╭─╯ ╰─╮ ╭─╯
4.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
3.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
2.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
1.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
0.00 ┼ ╰╮ ╭╯ ╰╮ ╭╯
-1.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-2.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-3.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-4.00 ┤ ╰─╮ ╭─╯ ╰─╮ ╭─╯
-5.00 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-6.00 ┤ ╰─╮ ╭─╯ ╰─╮ ╭─╯
-7.00 ┤ ╰─────╯ ╰─────╯
2.00 ┼─────────────────────────────────────────────────────────────────────────────────────────
2.00 ┼─────────────────────────────────────────────────────────────────────────────────────────
0.00 ┼─────────────────────────────────────────────────────────────────────────────────────────
0.00 ┼─────────────────────────────────────────────────────────────────────────────────────────
jess@Jess-N141ZU:~/git/asciichart$ echo $?
0
BTW it may not be immediately apparent on the test.py
runs, but the PR's graph pads with whitespace all the way out to the end of the graph; the master's graph has no trailing whitespace. You can see it if you highlight the lines.