npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@3df-spa/charts

v1.5.2

Published

Pure SVG chart components for Vue 3 — zero dependencies, TypeScript, responsive

Downloads

1,068

Readme

@3df-spa/charts

6 chart types for Vue 3 — Pure SVG · Zero runtime dependencies · TypeScript · Responsive · Dark mode

npm version License: MIT Vue 3 Zero deps TypeScript

Pure SVG chart components built from scratch for Vue 3. No Canvas, no D3, no heavy charting library — just clean SVG computed from your data, with responsive resize via ResizeObserver, smooth requestAnimationFrame animations, and full TypeScript types.


Installation

pnpm add @3df-spa/charts

Requires Vue 3 as peer dependency:

pnpm add vue  # if not already installed

Recommended: pair with @3df-spa/ui to get the theme tokens used for chart colors:

pnpm add @3df-spa/ui

Setup

If you're using @3df-spa/ui, the color tokens are already available after:

@import "tailwindcss";
@import "@3df-spa/ui/theme.css";

If you're using @3df-spa/charts standalone, define the chart color tokens in your CSS:

:root {
  --color-chart-1: hsl(145 55% 48%);
  --color-chart-2: hsl(200 80% 55%);
  --color-chart-3: hsl(38 92% 50%);
  --color-chart-4: hsl(280 65% 60%);
  --color-chart-5: hsl(0 72% 55%);
  --color-chart-6: hsl(170 60% 45%);
}

Quick start

<script setup lang="ts">
import { UiChartBar } from '@3df-spa/charts'
import type { ChartConfig, ChartDataRow } from '@3df-spa/charts'

const data: ChartDataRow[] = [
  { month: 'Jan', revenue: 4200, expenses: 2100 },
  { month: 'Feb', revenue: 5800, expenses: 2400 },
  { month: 'Mar', revenue: 5100, expenses: 2800 },
  { month: 'Apr', revenue: 6300, expenses: 2200 },
  { month: 'May', revenue: 7100, expenses: 3100 },
]

const config: ChartConfig = {
  revenue: { label: 'Revenue', color: 'var(--color-chart-1)' },
  expenses: { label: 'Expenses', color: 'var(--color-chart-2)' },
}
</script>

<template>
  <UiChartBar
    :data="data"
    :config="config"
    index="month"
    :categories="['revenue', 'expenses']"
    class="h-64 w-full"
  />
</template>

Chart types

📊 Bar Chart — UiChartBar

Grouped or stacked vertical/horizontal bars with animated entry and grid lines.

<UiChartBar
  :data="data"
  :config="config"
  index="month"
  :categories="['revenue', 'expenses']"
  :stacked="false"
  :show-legend="true"
  :show-tooltip="true"
/>

📈 Line Chart — UiChartLine

Smooth or linear lines with optional area fill, dots, and multi-series support.

<UiChartLine
  :data="data"
  :config="config"
  index="month"
  :categories="['revenue', 'expenses']"
  curve="smooth"        <!-- 'linear' | 'smooth' | 'step' -->
  :show-dots="true"
  :show-area="false"
/>

🥧 Pie Chart — UiChartPie

Pie or donut chart with animated draw and radial gradient fills.

<UiChartPie
  :data="categoryData"
  :config="config"
  index="category"
  :categories="['value']"
  :donut="true"
  :donut-thickness="0.55"
/>

🕸 Radar Chart — UiChartRadar

Polygon or line radar chart for multi-axis comparisons.

<UiChartRadar
  :data="skillData"
  :config="config"
  index="skill"
  :categories="['teamA', 'teamB']"
  variant="polygon"    <!-- 'polygon' | 'line' -->
/>

🔵 Scatter Chart — UiChartScatter

X/Y scatter plot with configurable shapes and optional size encoding.

<UiChartScatter
  :data="pointData"
  :config="scatterConfig"
  x-key="x"
  y-key="y"
  series-key="group"
/>

ScatterSeriesConfig supports shapes: circle, square, triangle, diamond, cross.


🎯 Gauge Chart — UiChartGauge

Arc-based gauge for KPI display with threshold segments and animated needle or fill.

<UiChartGauge
  :value="72"
  :min="0"
  :max="100"
  :segments="[
    { to: 40, color: 'var(--color-chart-5)' },
    { to: 70, color: 'var(--color-chart-3)' },
    { to: 100, color: 'var(--color-chart-1)' },
  ]"
  variant="arc"        <!-- 'arc' | 'needle' -->
/>

Configuration

ChartConfig

Maps each series key to its label and color:

import type { ChartConfig } from '@3df-spa/charts'

const config: ChartConfig = {
  revenue: {
    label: 'Revenue',
    color: 'var(--color-chart-1)',   // CSS variable or any valid color
  },
  expenses: {
    label: 'Expenses',
    color: 'hsl(200 80% 55%)',
  },
}

ChartDataRow

A flat object where one key is the category index and the rest are numeric series values:

import type { ChartDataRow } from '@3df-spa/charts'

const data: ChartDataRow[] = [
  { month: 'Q1', revenue: 12000, expenses: 8000 },
  { month: 'Q2', revenue: 15000, expenses: 9500 },
]

Shared components

| Component | Description | |-----------|-------------| | UiChartContainer | Responsive wrapper with ResizeObserver. Provides { width, height } via slot props and ChartContext via provide. | | UiChartTooltip | Positioned tooltip that follows the pointer, styled automatically with theme tokens. | | UiChartLegend | Configurable legend with color swatches and labels. |

<!-- Custom chart layout using shared primitives -->
<UiChartContainer v-slot="{ width, height }">
  <svg :width="width" :height="height">
    <!-- your custom SVG -->
  </svg>
  <UiChartTooltip :data="tooltipData" />
  <UiChartLegend :config="config" />
</UiChartContainer>

Colors

Charts resolve var(--color-chart-N) CSS variables at mount time using getComputedStyle. This ensures correct colors in both light and dark mode without any extra configuration.

Default palette (provided by @3df-spa/ui/theme.css):

| Token | Default | |-------|---------| | --color-chart-1 | hsl(145 55% 48%) — green | | --color-chart-2 | hsl(200 80% 55%) — blue | | --color-chart-3 | hsl(38 92% 50%) — amber | | --color-chart-4 | hsl(280 65% 60%) — purple | | --color-chart-5 | hsl(0 72% 55%) — red | | --color-chart-6 | hsl(170 60% 45%) — teal |

Override any token in your CSS to change chart colors globally.


TypeScript exports

import type {
  ChartConfig,
  ChartSeriesConfig,
  ChartDataRow,
  ChartOrientation,
  ChartStackMode,
  ChartAxisConfig,
  ChartTooltipData,
  ChartContext,
  NiceScale,
  CurveType,
  RadarVariant,
  ScatterShape,
  ScatterSeriesConfig,
  ScatterConfig,
  GaugeVariant,
  GaugeSegment,
} from '@3df-spa/charts'

Repository


License

MIT © 3DF SpA