# tiny-spark [![npm](https://img.shields.io/npm/v/tiny-spark)](https://github.com/graphieros/tiny-spark) [![GitHub issues](https://img.shields.io/github/issues/graphieros/tiny-spark)](https://github.com/graphieros/tiny-spark/issues) [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/graphieros/tiny-spark?tab=MIT-1-ov-file#readme) [![npm](https://img.shields.io/npm/dt/tiny-spark)](https://github.com/graphieros/tiny-spark) An elegant, reactive and responsive sparkline chart solution without dependency. image [DEMO](https://tiny-spark.graphieros.com/) ## Installation ``` npm i tiny-spark ``` ## Usage Import the file in your project: ```js import { render } from "tiny-spark"; // If you need to fetch data, call render afterwards getData().then(render); // If you hardcode your dataset, you can call render immediately ``` Calling render again will re-trigger the animation (if data-animation is set to "true"). Just set up a div with a "tiny-spark" class, with a few data attributes to configure the chart. Note that providing data-id is optional, a unique id will be generated if you don't. Render a line chart: ```html
``` Render a bar chart: ```html
``` ## Styling tiny-spark is headless. Target the following css classes to customize elements: ```css /** the chart container (div element) */ .tiny-spark { } /** the tooltip (div element) */ .tiny-spark-tooltip { /** just display:none if you don't need it */ } /** the indicator (svg line element) */ .tiny-spark-indicator { /** for example: customize stroke-dasharray */ } /** the plots (svg circle element) */ .tiny-spark-datapoint-circle { } /** the chart line (svg path element) */ .tiny-spark-line-path { } /** the chart area (svg path element) */ .tiny-spark-line-area { } ```