A lightweight and customizable Sparkline component for Svelte 5, based on fnando/sparkline (used on npm to show a chart for weekly downloads), with va

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-11-20 13:30:14

A lightweight and customizable Sparkline component for Svelte 5, based on fnando/sparkline (used on npm to show a chart for weekly downloads), with various improvements and updates. Works on touchscreens, tested on all browsers.

This library creates a small responsive line chart (apparently called "sparkline" for whatever reason)--without axis labels--for quick data visualization. It is ideal for displaying trends and patterns in data in a compact form--making it good for use in dashboards, reports, etc. The SVG output scales to fit its container for responsiveness on different screen sizes.

Changes to the data prop or any option will update the SVG reactively (with svelte 5 managing the SVG dom updates). Performance should be optimal as it just atomically updates the necessary svg paths and the display logic is trivial.

The Sparkline component accepts the following props (only the options.lineColor prop is needed to change all the colors automatically. The other options can be mostly ignored):

Leave a Comment