Skip to content

v2.2.0 — CSS Theming & Smart Axes

Latest

Choose a tag to compare

@benaskins benaskins released this 15 Mar 08:52

All styling moved to CSS. Smart y-axis ticks. Three themes.

CSS Theming

  • All visual properties controlled via CSS custom properties
  • No inline styles — override anything with plain CSS
  • Series colors via --sg-series-0, --sg-series-1, etc.

Themes (add a class to your container)

  • sg-tufte — maximum data-ink ratio, no grid, serif labels
  • sg-midnight — dark background, luminous data
  • sg-warmth — earthy tones on cream

Smart Y-Axis

  • Nice round tick intervals (1, 2, 5, 10, 20, 50...)
  • Tick count adapts to chart height
  • Grid lines align with tick values

Reactive API (from v2.1)

  • chart.update(data) — re-render in place
  • chart.destroy() — remove from DOM
  • Idempotent — calling simplegraph() on same target replaces previous graph
  • Accepts SVG elements directly for framework integration