Skip to content

SketchyChart

A Neo-Brutalist hand-drawn style chart component, rendered purely with Vue <svg>. Uses SVG fractal noise filters to add wobble to axes, lines, and bar edges, perfectly mimicking a handwritten sketch aesthetic. Zero external dependencies.

Demo

Preview

折线图

手绘风格折线图023456890一月二月三月四月五月六月

柱状图

手绘风格柱状图021436485VueReactSvelteAngular

饼图

手绘风格饼图

高抖动幅度 (sketchiness=8)

手绘风格折线图023456890一月二月三月四月五月六月

关闭网格线 (grid=false)

手绘风格柱状图021436485VueReactSvelteAngular

自定义尺寸 (width=400, height=250)

手绘风格折线图023456890一月二月三月四月五月六月

Installation

pnpm dlx brutx-vue@latest add sketchy-chart

Usage

vue
<script setup>
import { SketchyChart } from 'brutx-ui-vue'

const data = [
    { label: 'Jan', value: 30 },
    { label: 'Feb', value: 65 },
    { label: 'Mar', value: 45 },
]
</script>

<template>
    <SketchyChart type="line" :data="data" />
</template>

Variants

VariantDescription
lineLine chart with shadow fill area and node circles
barBar chart with hatch pattern fill and hard shadows
piePie chart using design token color palette and thick black borders
vue
<template>
    <SketchyChart type="bar" :data="data" />
</template>

Sketchy Jitter

The sketchiness prop controls the hand-drawn jitter amplitude (0-10). Higher values produce more pronounced wobble:

vue
<SketchyChart type="line" :data="data" :sketchiness="8" />

Data Handling

  • Empty array: Line/bar charts render an empty chart frame (axes only); pie charts render blank
  • Negative values: Absolute value is used
  • Large datasets (>30 items): Automatic downsampling

Props

PropTypeDefaultDescription
type'line' | 'bar' | 'pie''line'Chart type
dataArray<{ label: string, value: number }>[]Chart data source
sketchinessnumber2Hand-drawn jitter amplitude (0-10)
gridbooleantrueWhether to draw background grid (ignored for pie charts)
widthnumber600Chart width (px)
heightnumber400Chart height (px)
classstringExternal class override

Accessibility

  • ARIA attributes: SVG sets role="img" and aria-label
  • Screen readers: Includes a <title> element for screen reader narration

Brute force builds.