LedgerUI.Components.Sparkline (LedgerUI v0.2.0)

Copy Markdown View Source

The canvas's sparkline (lu-spark): a line with a soft fill under it, drawn on the server from a list of numbers (the highest at the top), so it renders without JavaScript.

<.sparkline id="bb" values={[8, 12, 9, 14, 11, 16]} />
<.sparkline id="itau" values={@balances} color="primary" />

color="primary" draws it in the accent, neutral (default) in the ink. The SVG stretches to the width of its box (preserveAspectRatio="none"); the box gets its size from class/style. id names the gradient of the fill and must be unique on the page.

Summary

Functions

sparkline(assigns)

Attributes

  • id (:string) (required) - Names the gradient of the fill, so it must be unique.
  • values (:list) (required) - Numbers for the line.
  • color (:string) - Defaults to "neutral". Must be one of "neutral", or "primary".
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.