kroitor / asciichart

Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies
MIT License
1.87k stars 94 forks source link

Python #12

Closed callamd closed 5 years ago

callamd commented 6 years ago

Python output looks terrible in a terminal, and there isn't any documentation on python support.

Also, I keep getting 0 division errors trying to plot floats.

Help?

kroitor commented 6 years ago

Can you post some code and output to reproduce it, plz?

elijahfhopp commented 5 years ago

@cal97g, I believe the issue you are having is an issue of the graph being larger than your terminal's. You can fix it by either making your terminal larger(that much is obvious, LOL), but the graph might be larger than you can make your terminal. In that case, reduce the number of data-points you have.

callamd commented 5 years ago

@kroitor @MrZeusTheCoder - possibly this is the case. Is it possible for the script to sample the data points if this is the case? It should be aware of terminal sizing right?

My graph was 1000's of data points. Don't currently have it but may be able to reproduce.

kroitor commented 5 years ago

Is it possible for the script to sample the data points if this is the case? It should be aware of terminal sizing right?

It is, but adding the functionality to track the size of the terminal window will bloat this repo and it is something that we would like to leave outside of the package – for compatibility reasons. Determining width on Windows and *nix is done differently, so to support for auto-width, we will have to add an amount of code comparable to a micro OS, whereas this entire package is less than 100 lines... This isn't what we want, as we'd like to keep it compact, so that you could run it on your watch or with your Arduino...

My graph was 1000's of data points. Don't currently have it but may be able to reproduce.

Yep, as documented on the main page: The width of the chart will always equal the length of data series. The height and range are determined automatically. So, if you want to have a reduced set of data points, reduce them in userland according to your needs before passing the filtered set to the plotting function.

There are standalone packages that allow to adjust for screen width in text mode, check out curses, ncurses or blessed, for example.

Hope this answers your question, let us know if not. Closing it for now, if you don't mind, feel free to reopen it if needed or just ask further questions if you have more, will be happy to reply asap.