The Tao of Unicode Sparklines (2021)
blog.jonudell.net
blog.jonudell.net
Sparklines have a few important properties which these do not exhibit. They’re typically higher resolution, with more data per inch. Also the slopes from point to point, and the whitespace under the typical graph/sparkline, help readability.
Sixels could be used here too, but native support for vector graphics would be nicer.
I’m also of the opinion that sixel sucks as a modern option. It’s got a low DPI resolution, cannot be compressed, and is its own bespoke specification which means lots of additional work for terminal maintainers. Which is why most terms these days go with their own escape sequences for natively supporting common formats like PNG and JPEG.
In my own terminal emulator, I’ve got support for several image formats but I doubt I’ll ever bother with sixel.
Personally I’d rather see in-lined vector graphics become better supported. This was available on some of the Techtonix (iirc) hardware VTs and as far as I know, the only widespread terminal emulator to support that particular mode is xterm.
I was thinking along the lines of online (or inline) fonts, similar to web fonts in CSS, which would allow for arbitrary custom glyphs.
As far as I know, there is no terminal emulator that supports this flavor if sixel graphics.
[1] https://github.com/ratatui/ratatui/blob/20c88aaa5b9eb011a522...
Speaking of misaligned characters: an upgrade a few months back in some thing (font, terminal, or renderer) caused the characters to be shifted up or down one pixel so the bottom and top now touch between lines
* https://en.wikipedia.org/wiki/Jon_Udell
He stood up their first web site in 1995:
> One day this spring, an HTTP request popped out the back of my old Swan 386/25, rattled through our LAN, jumped across an X.25 link to BIX, negotiated its way through three major carriers and a dozen hosts, and made a final hop over a PPP link to its rendezvous with BYTE's newborn Web server, an Alpha AXP 150 located just 2 feet from the Swan.
* https://web.archive.org/web/19990128182622/http://www.byte.c...
* https://twitter.com/judell/status/1278883833903898624
* https://vintageapple.org/byte/pdf/199507_Byte_Magazine_Vol_2...
Imagine:
<sparkline src="an image or csv"\>
One cool thing about SVG is it can inherit styles from your application, so you can produce e.g. dark-mode aware graphics rather easily, also one of the perks of this Unicode approach.But for an annotated data set that renders as a sparkline, a custom element with an SVG shadow DOM probably makes sense. Definitely more work than the "this'll do for most folks" solution though =D
it also solves the problem where sparklines feel useful to somebody reading a summary and not so useful to somebody that's just exploring data "in the moment." having it be available in postgres is brilliant.
a bit of shameless self promotion, i had done something similar ages ago but with a custom webfont and some small js to handle scaling of the input dataset, solving the problem of unicode graph characters not being baseline aligned well. http://nsfmc.github.io/chartjunk/ (turns into dust while looking at the last commit date)
If this is a deal breaker because you’re aspiring for Edward Tufte levels of visualization purity, OP also offers an alternative that omits below-the-baseline U+2584 and U+2588. The trade off is having fewer unequally sized buckets for the data.
(Could there be font faces without this rendering issue?)
A comment under OP suggests that the rendering issue is font-dependent. When I view a Unicode sparkline on a test page [1], the rendering issue occurs using Arial, Courier New, Gill Sans, Helvetica, or Times New Roman, but appears to be fixed if I use Georgia, Menlo, or Comic Sans.
[1]: https://github.com/aftertheflood/sparks
[2]: https://observablehq.com/@tomgp/after-the-flood-i-sparks-i-t...
With Unicode 16, which is coming out very shortly, there will be 2x4 mosaics (originally identified on Kaypro CP/M machines), which have about half the vertical resolution of the blocks, but twice the time resolution (and allows us to leave Braille for what it was intended for).
After this post came out, Unicode 13 introduced Teletext 2x3 mosaics and their "smoothed" versions (with diagonal lines). Those are also useful for sparklines.
https://github.com/sudara/melatonin_audio_sparklines
The reason this is such a nerd tickle, is that sudara even went as far as to teach lldb how to render arrays' using sparklines, meaning one can get a pretty useful clue about the contents of an audio buffer within the debugger:
https://forum.juce.com/t/new-audio-sparklines-module/46606
This, to me, aligns very much with the "Tao" of sparklines - although of course I've modified my local copy to use unicode fonts, which is either heinous or fabulous, depending on how much coffee I've had before I have to hit up lldb for details about why my day is going to be good/bad... ;)
Also none of them drop below the baseline in the main page text, only in the code block.
(Firefox on Ubuntu 20.04)
And unlike the author, LOWER HALF BLOCK (U+2584) does not dip below the line.
Aah, multi-platform font rendering... ;)
Along similar lines, the absolutely delightful FF Chartwell has sparkline capabilities, plus a lot, lot more to boot (and it actually predates After-the-Floods attempt by half a decade):
Teletext in Unicode - each character is three pixels tall, two pixels wide, with separate characters for inverse as well, and diagonals to get you from one set to another.
https://en.wikipedia.org/wiki/Teletext_character_set#Graphic...
Intended for use with teletext graphics, but hey, do a sparkline with them, why not? Sure, it'll only do you four levels, but do you really need more than that in this use case?
Previously on Hacker News: https://news.ycombinator.com/item?id=40269606
If you segment your data into buckets, its a histogram.
Histospark? SparkGram?
If you set out to divide your data into buckets and hand-select the elements to represent the slope of the trend from a set of 8.. It's ..
Coming your way in Unicode 16.0...
Allow me to introduce: BOTTOM LEFT JUSTIFIED UPPER RIGHT QUARTER BLACK CIRCLE!
https://www.unicode.org/charts/PDF/Unicode-16.0/U160-1FB00.p...
But wait! There's more! U+1CC31, UPPER CENTRE LEFT TWELFTH CIRCLE! And you best believe there's 11 more.
https://www.unicode.org/charts/PDF/Unicode-16.0/U160-1CC00.p...
My biggest gripe here is that we will need to kill UTF-16 so we can have a larger set of codepoints, and that's only a gripe because killing UTF-16 is going to be really difficult, not because I want to keep UTF-16 (oh no, UTF-16 really needs to die).
I, for one, would love to see a UI that is composed entirely of typographic symbology, even to the point that it would function beyond the normal UI paradigms. I'm a huge fan of things like FF Chartwell, where the font contains super rich, detailed information that is not just a 'letter' or 'character' .. See https://news.ycombinator.com/item?id=41365761 if you don't know what FF Chartwell is yet, maybe you'll enjoy it, maybe not ..