An open API service indexing awesome lists of open source software.

https://github.com/react-sandbox/sparkline

📈 Sparkline chart
https://github.com/react-sandbox/sparkline

chart component react react-sparkline sparkline svg typescript

Last synced: 3 months ago
JSON representation

📈 Sparkline chart

Awesome Lists containing this project

README

        


@react-sandbox/sparkline


Build status
Dependencies
Build size
Package downloads


Example

📈 Sparkline SVG component.

## Usage

### Install

Install the `@react-sandbox/sparkline` package:

```
npm install @react-sandbox/sparkline
```

### Import

Import the `Sparkline` component:

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

function App() {
return (




)
}
```

### Props

| Prop | Type | Default | Description |
| ------------- | --------------------- | ------------ | ---------------------- |
| `values` | `Array` | **required** | Y-coordinates on graph |
| `width` | `number` | **required** | Sparkline width |
| `height` | `number` | **required** | Sparkline height |
| `lineColor` | `string` | `'#4989eb'` | Line stroke color |
| `lineWidth` | `number` | `3` | Line stroke width |
| `fillColor` | `string` | `'#b2cff2'` | Fill area color |
| `fillOpacity` | `number` | `1` | Fill area opacity |
| `className` | `string` | `-` | CSS classes |
| `style` | `React.CSSProperties` | `-` | CSS styles |

## Development

### Local

```
pnpm install
pnpm dev
```

### Tests

```
pnpm test
```

### Example

Inside `test/`:

```
pnpm install
pnpm dev
```

## License

MIT