1.0.1 • Published 2 years ago

react-animated-svg-sparkline v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-animated-svg-sparkline

Responsive Animated SVG sparkline React component

Features

  • SVG Animation
  • No dependencies
  • Dark theme only (as shown in the preview gif)

NPM JavaScript Style Guide

React Animated SVG Sparkline

Install

yarn add react-animated-svg-sparkline
npm install --save react-animated-svg-sparkline

Usage

import ReactAnimatedSVGSparkline from 'react-animated-svg-sparkline';
import 'react-animated-svg-sparkline/dist/index.css';

<div style={{ background: '#000' }}>
  <ReactAnimatedSVGSparkline
    width={1900}
    height={620}
    strokeWidth={8}
    paddingY={80}
    showGrid={true}
    data={[9,10,5,1,6,5,8,1,7,15,13.2,15]}
    className="svg-style"
    tipText="123"
  />
</div>

Props

PropTypeDefaultNote
dataArray[]Array of numbers to be plotted
widthNumber800<svg> element width
heightNumber400<svg> element height
paddingXNumber0Horizontal padding
paddingYNumber0Vertical padding
classNameStringnull<svg> CSS class
strokeWidthNumber6Sparkline stroke width
showGridBooleantrueWheter or not show grid
tipTextStringnullLast point tooltip content
tipTextWidthNumber120Last point rectangle width

License

MIT © Eduardo Lomelí