
Show HN: ASCII line chart with console, HTML and image outputs, written in PHP - noximo
https://github.com/noximo/PHP-colored-ascii-linechart
======
protomikron
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](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
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](https://en.wikipedia.org/wiki/Box-drawing_character)

------
tutfbhuf
I 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)

------
fluxsauce
Nicely 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
> 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
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](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)

------
gitgud
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.

------
guptarohit
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](https://github.com/guptarohit/asciigraph)

------
lixtra
What’s your use case for this?

~~~
noximo
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.

