1.1.0 • Published 9 months ago

@react-sandbox/sparkline v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Usage

Install

Install the @react-sandbox/sparkline package:

npm install @react-sandbox/sparkline

Import

Import the Sparkline component:

import React from 'react'
import Sparkline from '@react-sandbox/sparkline'

function App() {
  return (
    <div>
      <Sparkline
        values={[1, 2, 1, 4, 6, 8, 6]}
        width={50}
        height={50}
      />
    </div>
  )
}

Props

PropTypeDefaultDescription
valuesArray<number>requiredY-coordinates on graph
widthnumberrequiredSparkline width
heightnumberrequiredSparkline height
lineColorstring'#4989eb'Line stroke color
lineWidthnumber3Line stroke width
fillColorstring'#b2cff2'Fill area color
fillOpacitynumber1Fill area opacity
classNamestring-CSS classes
styleReact.CSSProperties-CSS styles

Development

Local

pnpm install
pnpm dev

Tests

pnpm test

Example

Inside test/:

pnpm install
pnpm dev

License

MIT