SparklineSvg - Create SVG Sparkline

Hi! :wave:

I’ve released SparklineSvg, a simple yet customizable, zero-dependency Elixir library for generating SVG sparkline charts.

The repository can be found on GitHub - sparkline_svg.

Documentation is available on Hex - SparklineSvg.

Features

  • Supports various datapoint shapes.
  • Pixel-perfect customization with options to show dots, lines, and areas.
  • Ability to add vertical markers (lines or areas).
  • Includes common reference lines.

Background

The goal is to provide something simple and stable for building dashboards. The library focuses exclusively on generating SVG sparkline charts (and will only do that in the future).

What’s next?

I plan to add a few more options to the library, with the goal of reaching a stable 1.0 version quickly. Here are some points I’m considering, but I would love to hear your ideas:

  • Support normal bands, inspired by this concept: React Sparklines.
  • Allow setting the window manually. Currently, the window is auto-set based on datapoints, but manual adjustment may be useful.
  • Support nil (holes) in the datapoints.
13 Likes

Just released new version:

  • Support :padding option specifying padding for specific side
  • Expose number :precision through general options
  • Support percentile/1 reference line
  • Support custom reference lines
1 Like

Very good documentation! Thank you for sharing!

1 Like

Just released 0.5 version with:

  • Support :sort option to control data sorting
  • Add set_x_window/2 function with :min and :max options

Thanks a lot for these kind words @fuelen :pray: