2 ms·
Although of course, we don't even need a custom element here, this already has a pure-CSS solution: https://jsbin.com/xuwicoquwo/edit?html,css,js,output https:/
by TheRealPomax 2y ago
Although of course, we don't even need a custom element here, this already has a pure-CSS solution: https://jsbin.com/xuwicoquwo/edit?html,css,js,output https://jsbin.com/xuwicoquwo/edit?html,css,js,output
- pphysch 2y agoNice. A real SVG sparkline would use polyline or path, though. Not much point in using Unicode glyphs.
- TheRealPomax 2y agoEh, you'd probably use <rect> rather than a single <path>, because then you can trivially slice your sparkline and tag every tick with metadata. So for simple sparklines you don't really need a custom element. Page elements already follow a box model, just CSS them boxes =) 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