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

Graph characters not clearing on row change (asciichartpy)? #50

Open
DoktorJ opened this issue Jun 16, 2020 · 7 comments
Open

Graph characters not clearing on row change (asciichartpy)? #50

DoktorJ opened this issue Jun 16, 2020 · 7 comments
Assignees

Comments

@DoktorJ
Copy link

DoktorJ commented Jun 16, 2020

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.

asciichartpy bug

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.

@DoktorJ
Copy link
Author

DoktorJ commented Jun 16, 2020

(ignore the colors, that's just an artifact of my HDMI capture device; it's all one color on-screen)

@DoktorJ
Copy link
Author

DoktorJ commented Jun 16, 2020

Opened PR #51 for this

@kroitor kroitor self-assigned this Jun 16, 2020
@kroitor
Copy link
Owner

kroitor commented Jun 16, 2020

@DoktorJ thank you! Will check and merge shortly!

@kroitor
Copy link
Owner

kroitor commented Jun 17, 2020

@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).

@kroitor
Copy link
Owner

kroitor commented Jun 17, 2020

@DoktorJ also, it would help if you could post your result of test.py (run it from the cloned repo).

@DoktorJ
Copy link
Author

DoktorJ commented Nov 13, 2020

@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

@DoktorJ
Copy link
Author

DoktorJ commented Nov 13, 2020

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.

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

2 participants