Skip to content
Back to skills

Sparkline

ASecurity

Compact inline charts for embedding in dashboards and metric displays. Four variants: line, area, bar, and sonar (diverging stacked bar). All hide axes, gridlines, and labels by default for a minimal appearance.

  • 4 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added May 27, 2026
data-aigoreact

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add reaviz/skills --skill sparkline --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sparkline?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sparkline
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/reaviz-sparkline/badge)](https://www.skillsdirectory.com/skills/reaviz-sparkline)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Sparkline

Compact inline charts for embedding in dashboards and metric displays. Four variants: line, area, bar, and sonar (diverging stacked bar). All hide axes, gridlines, and labels by default for a minimal appearance.

## Import

```tsx
import {
  SparklineChart,
  AreaSparklineChart,
  BarSparklineChart,
  SonarChart
} from 'reaviz';
```

## SparklineChart (Line)

Line sparkline with smooth interpolation, hover points, and no area fill.

### Props

Extends LineChart/AreaChart props with sparkline defaults.

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `data` | `ChartShallowDataShape[]` | — | Chart data |
| `width` | `number` | auto | Width in pixels |
| `height` | `number` | auto | Height in pixels |
| `margins` | `Margins` | — | Chart margins |
| `series` | `ReactElement<AreaSeriesProps>` | line-only, smooth, strokeWidth 2 | Series component |
| `xAxis` | `ReactElement` | hidden, type `time`, scaled | X axis |
| `yAxis` | `ReactElement` | hidden, type `value`, scaled | Y axis |
| `gridlines` | `ReactElement \| null` | `null` | Gridlines (hidden) |

### Usage

```tsx
<SparklineChart
  width={200}
  height={55}
  data={data}
/>
```

## AreaSparklineChart

Area sparkline with striped mask, gradient fill, and smooth interpolation.

### Props

Same as SparklineChart. Default series includes:
- Striped mask pattern
- Gradient from transparent (10%) to opaque (80%)
- Line strokeWidth of 3
- Hover points

### Usage

```tsx
<AreaSparklineChart
  width={200}
  height={85}
  data={data}
/>
```

## BarSparklineChart

Bar sparkline with single color scheme.

### Props

Extends BarChart props with sparkline defaults.

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `data` | `ChartShallowDataShape[]` | — | Chart data |
| `width` | `number` | auto | Width in pixels |
| `height` | `number` | auto | Height in pixels |
| `margins` | `Margins` | — | Chart margins |
| `series` | `ReactElement<BarSeriesProps>` | single cybertron color | Series component |
| `xAxis` | `ReactElement` | hidden, type `category` | X axis |
| `yAxis` | `ReactElement` | hidden, type `value` | Y axis |
| `gridlines` | `ReactElement \| null` | `null` | Gridlines (hidden) |

### Usage

```tsx
<BarSparklineChart
  width={200}
  height={35}
  data={data}
/>
```

## SonarChart

Stacked diverging bar chart for signal/activity visualization. Bars extend both up and down from center.

### Props

Extends BarChart props. Uses `ChartNestedDataShape[]` data.

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `data` | `ChartNestedDataShape[]` | — | Nested data (two values per entry) |
| `width` | `number` | auto | Width in pixels |
| `height` | `number` | auto | Height in pixels |
| `margins` | `Margins` | `0` | Chart margins |
| `series` | `ReactElement` | stackedDiverging with gradient bars | Series component |
| `xAxis` | `ReactElement` | hidden, type `category` | X axis |
| `yAxis` | `ReactElement` | hidden, type `value` | Y axis |
| `gridlines` | `ReactElement \| null` | `null` | Gridlines (hidden) |

### Usage

```tsx
const sonarData = [
  { key: 'T1', data: [
    { key: 'up', data: 5 },
    { key: 'down', data: 3 },
  ]},
  { key: 'T2', data: [
    { key: 'up', data: 8 },
    { key: 'down', data: 2 },
  ]},
];

<SonarChart
  width={300}
  height={50}
  data={sonarData}
/>
```

## Common Data Shape

All sparkline variants (except SonarChart) use flat data:

```tsx
const data = [
  { key: new Date('2024-01-01'), data: 10 },
  { key: new Date('2024-02-01'), data: 25 },
  { key: new Date('2024-03-01'), data: 18 },
];
```

## Customization

All variants accept their parent chart's props, so you can override defaults:

```tsx
// Custom line color
import { LineSeries, Line } from 'reaviz';

<SparklineChart
  width={200}
  height={55}
  data={data}
  series={
    <LineSeries
      interpolation="linear"
      line={<Line strokeWidth={1} />}
      colorScheme="#FF5722"
    />
  }
/>
```

## Notes

- All variants hide axes, gridlines, tick marks, and labels by default
- SparklineChart and AreaSparklineChart use `scaled={true}` on axes for tight data fitting
- SparklineChart shows points on hover; set `symbols={null}` to disable
- AreaSparklineChart uses a `Stripes` mask over a gradient fill
- SonarChart uses `type="stackedDiverging"` with two gradient bars and absolute-value tooltips
- Designed for small dimensions — typical heights are 35-85px

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in data-ai →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.