4 ms·
Show HN: ASCII line chart with console, HTML and image outputs, written in PHP
- gitgud 8y agoCool 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.
- protomikron 8y agoNice 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 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
- noximo 8y agoThank 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 https://en.wikipedia.org/wiki/Box-drawing_character
- fluxsauce 8y agoNicely done! Glad to see the explicit shout-out to https://github.com/kroitor/asciichart https://github.com/kroitor/asciichart FYI, the original calls itself ASCII chart because it limits itself to ASCII - https://en.wikipedia.org/wiki/ASCII https://en.wikipedia.org/wiki/ASCII However, the curved shapes are from https://en.wikipedia.org/wiki/Code_page_866 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.
- jwilk 8y ago> curved shapes are from https://en.wikipedia.org/wiki/Code_page_866 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).
- fluxsauce 8y agoGood 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 https://en.wikipedia.org/wiki/Box-drawing_character#DOS or https://en.wikipedia.org/wiki/Code_page_437 https://en.wikipedia.org/wiki/Code_page_437
- noximo 8y agoThanks. I'm using the same characters that the original uses. Pretty much ctrl+c ctrl+v them into my code :)
- guptarohit 8y agoAwesome! 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 https://github.com/guptarohit/asciigraph
- sAbakumoff 8y agoI know your problem. You have too much free time;
- lixtra 8y agoWhat’s your use case for this?
- tutfbhuf 8y agoFor example https://github.com/madnight/bitcoin-chart-cli https://github.com/madnight/bitcoin-chart-cli
- noximo 8y agoI'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.
- tutfbhuf 8y agoI can also recommend: https://github.com/kroitor/asciichart https://github.com/kroitor/asciichart (JS, Py) https://github.com/guptarohit/asciigraph https://github.com/guptarohit/asciigraph (Go) https://github.com/madnight/asciichart https://github.com/madnight/asciichart (Haskell)