Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: ASCII line chart with console, HTML and image outputs, written in PHP (github.com/noximo)
74 points by noximo on Aug 5, 2018 | hide | past | favorite | 12 comments


Nice work, I love exploiting unicode characters to "draw" in terminal environments. You seem to use '╰', '╮', '╭' and '╯' to approximate non-straight lines, interesting idea, I haven't seen this before.

Another approach is to use block characters, like U+259A or U+259E (see https://en.wikipedia.org/wiki/Block_Elements), but unfortunately it is hard to do when you want to support colors as it doesn't go well with intersections.

//edit: HN does not like block elements, but your 21th century terminal will print them


Thank you! Well, the idea wasn't mine, I built it upon another library.

But from what I gathered, these symbols are made for drawing, so I'm not really exploiting anything: https://en.wikipedia.org/wiki/Box-drawing_character



Nicely done! Glad to see the explicit shout-out to https://github.com/kroitor/asciichart

FYI, the original calls itself ASCII chart because it limits itself to ASCII - https://en.wikipedia.org/wiki/ASCII

However, the curved shapes are from https://en.wikipedia.org/wiki/Code_page_866 which originated from the USSR and was used in DOS and OS/2 to write Cyrillic script.

I honestly didn't know until I searched for it; I was curious and didn't recognize the characters.


> curved shapes are from https://en.wikipedia.org/wiki/Code_page_866

No? Even this very Wikipedia article says CP866 inherited the box-drawing characters from CP437 (and I bet that wasn't the first character set that had them).


Good point, but I was specifically talking about the ╭ ╮ ╯ ╰ characters; those were added in 866, and they're not included in https://en.wikipedia.org/wiki/Box-drawing_character#DOS or https://en.wikipedia.org/wiki/Code_page_437


Thanks.

I'm using the same characters that the original uses. Pretty much ctrl+c ctrl+v them into my code :)


Cool little project, I would put the gif of the graph at the beginning of the Readme before the advanced example. This shows off the application a bit earlier.


Awesome! Good to see you added two new features, i.e. color and multiline. Check the one ported to the Go https://github.com/guptarohit/asciigraph


What’s your use case for this?


I'm trying to make a trading bot but shifting through over a milion of historical prices tends to be a bit uncomfortable when they are outputted in a simple table.

So i looked for some chart that could help me visualize it but found none written in php so I wrote one myself.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: