vue-chartjs

A Vue.js wrapper for Chart.js that turns chart configs into reusable, reactive chart components.

Library
npm
v5.3.4
5,717 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
68 /100 Good
Development Activity 48
Maintenance 44
Community 80
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
75 /100 Good
Architecture 85
Code Quality 80
Innovation 78
Learning Curve 55

vue-chartjs wraps Chart.js so Vue applications can render charts as ordinary components instead of imperatively managing a canvas and a Chart.js instance by hand. It ships a typed component for every Chart.js chart type (Bar, Line, Pie, Doughnut, PolarArea, Radar, Bubble, Scatter) plus a generic Chart component and a createTypedChart factory for building your own, so only the specific Chart.js controllers a chart needs get registered.

Under the hood it watches the data and options props, unwraps them from Vue’s reactivity proxies, and calls Chart.js’s own update() method with a configurable update mode instead of tearing down and recreating the chart on every change. The result is a thin, TypeScript-first bridge that stays close to Chart.js’s native configuration shape while handling the Vue-specific plumbing (reactivity, lifecycle, refs, accessibility attributes) that would otherwise be repeated in every project that pairs the two libraries.

What You Get

  • Prebuilt, typed Vue components for every core Chart.js chart type: Bar, Line, Pie, Doughnut, PolarArea, Radar, Bubble, and Scatter
  • A generic Chart component that accepts any Chart.js chart type via a type prop
  • A createTypedChart factory for generating your own typed component around a Chart.js controller the package doesn’t ship a shortcut for
  • Reactive data/options props that call Chart.js’s update() method instead of forcing a full re-render
  • Event helper utilities (getDatasetAtEvent, getElementAtEvent, getElementsAtEvent) for wiring chart click interactions
  • Support for both Vue 2.7 and Vue 3 from the same package via internal compat handling

Common Use Cases

  • Admin and analytics dashboards that visualize product or business metrics
  • SaaS reporting pages driven by live data from a Pinia or Vuex store
  • Embedding charts in Vue-based internal tools without writing raw Chart.js setup code
  • Interactive charts where clicking a bar, slice, or point drills into per-dataset detail views

Under The Hood

Architecture

The codebase is small and deliberately layered: src/chart.ts defines the core Chart component that owns the canvas ref and a shallowRef to the live Chart.js instance, wires onMounted/onUnmounted lifecycle hooks, and runs a deep watcher on the data/options props that diffs cloned data against Chart.js’s own config object before calling chart.update(). src/typedCharts.ts layers a createTypedChart factory on top of that core component: it registers only the specific Chart.js controller (BarController, LineController, DoughnutController, etc.) a given chart type needs and re-forwards a ref so callers can reach the underlying Chart.js instance. src/utils.ts isolates all the Vue-reactivity-proxy handling (toRawIfProxy, cloneProxy, cloneData/setDatasets/setLabels) that keeps Chart.js’s in-place config mutation safe against Vue’s reactive proxies, and props/types live in their own files. Every typed chart component composes the same core Chart component, so its diffing logic is a single point every chart type depends on.

Tech Stack

TypeScript in strict mode (noUnusedLocals, noImplicitReturns, isolatedModules) targeting ESNext, with Vue 3 as the primary peer dependency and Vue 2.7 supported via a version-string branch in compatProps. Chart.js v4 (BarController, LineController, etc.) is the other peer dependency. The package is bundled with Rollup (rollup-plugin-swc3) into dual ESM/CJS output, developed against Vite and tested with Vitest plus @vue/test-utils; Storybook (@storybook/vue3) hosts interactive chart sandboxes, tsd runs type-level tests, and size-limit enforces a bundle-size budget. Release tooling (commitlint, simple-git-hooks, standard-version, simple-github-release) automates versioning and changelog generation, and the whole project runs on pnpm.

Code Quality

Each typed chart component has a corresponding Vitest spec (Bar.spec.ts, Line.spec.ts, Doughnut.spec.ts, Pie.spec.ts, PolarArea.spec.ts, Radar.spec.ts, Bubble.spec.ts, Scatter.spec.ts) that mounts the component against fixture configs under sandboxes/*/src/chartConfig.js and asserts canvas rendering, id passthrough, and plugin wiring; a separate types.test-d.ts uses tsd to assert the exported type surface compiles correctly. Error handling is intentionally minimal (simple guard clauses rather than thrown/typed errors), which is reasonable for a thin wrapper library. Naming is consistent and descriptive throughout (setLabels/setDatasets/cloneData), TypeScript strict mode is enforced end to end, and ESLint plus Prettier run via pre-commit hooks. CI (checks.yml, ci.yml) runs type-checking, unit tests, and a Storybook build on every pull request.

API Design The public API stays deliberately close to Chart.js’s own configuration shape: consumers import a named component (Bar, Line, Pie, …) or the generic Chart with a type prop, and pass data/options objects matching Chart.js’s documented config directly, so there is no bespoke configuration DSL to learn beyond Chart.js’s own docs. createTypedChart is exported so teams can generate their own typed wrapper for a chart type the package doesn’t ship a shortcut for, and an exposed chart ref gives an escape hatch to the underlying Chart.js instance for anything the props API doesn’t cover. The main friction point is that consumers still need to explicitly register the Chart.js controllers/elements a chart type uses via ChartJS.register(…), which is a small but real bit of boilerplate carried over from Chart.js itself.

Used by 13 apps in this directory

Python
68%
Other

Baserow

Databases · No Code Platforms

6,205

Open-source no-code platform to build databases, apps, automations, and AI agents — self-hosted or cloud, with full data ownership.

View details
89
Repo Health
84
Technical
65
Dependency
Built with
Python 68%
JavaScript 17%
Vue 10%
Updated 6 days ago
Ruby
51%
Other

Chatwoot

Customer Support

38,155

Open-source omnichannel customer support platform with AI-powered agents, live chat, and self-hosting — a full Intercom and Zendesk alternative.

View details
95
Repo Health
78
Technical
66
Dependency
Built with
Ruby 51%
Vue 25%
JavaScript 22%
Updated 5 days ago
Vue
54%
GPL 3.0

Financial Freedom

Invoicing Finance

2,950

Own your financial data with a self-hosted, privacy-first budgeting app that replaces Mint and YNAB.

View details
60
Repo Health
67
Technical
71
Dependency
Built with
Vue 54%
PHP 44%
Updated 1 months ago
Python
66%
MIT

Flowfile

Data Engineering

398

Visual ETL that compiles to Polars — build pipelines on a canvas, export as standalone Python, and run anywhere without platform lock-in.

View details
83
Repo Health
81
Technical
66
Dependency
Built with
Python 66%
TypeScript 17%
Vue 16%
Updated 6 days ago
Go
91%
Apache 2.0

Gatus

Devops · Monitoring

12,386

Developer-oriented health dashboard with active endpoint probing, multi-protocol checks, and 40+ alerting integrations so you know about failures before your users do.

View details
84
Repo Health
84
Technical
75
Dependency
Built with
Go 91%
Updated 1 weeks ago
Go
83%
MIT

Gitea

Developer Tools · Devops · Project Management

58,668

Self-hosted DevOps in a single Go binary — Git hosting, GitHub Actions-compatible CI/CD, and 30+ package registries without any SaaS dependency.

View details
93
Repo Health
79
Technical
64
Dependency
Built with
Go 83%
Updated 5 days ago
Rust
51%
Other

hoodik

File Storage · Security

1,539

Self-hosted, end-to-end encrypted cloud storage with browser-based encryption and S3-compatible storage support

View details
77
Repo Health
71
Technical
63
Dependency
Built with
Rust 51%
TypeScript 34%
Vue 14%
Updated 1 weeks ago
Go
51%
AGPL 3.0

listmonk

Blogging · Marketing

23,944

High-performance, self-hosted newsletter and mailing list manager packaged as a single binary with built-in analytics, transactional messaging, and multi-channel delivery.

View details
90
Repo Health
74
Technical
64
Dependency
Built with
Go 51%
JavaScript 22%
HTML 20%
Updated 5 days ago
TypeScript
92%
Other

n8n

Automation · No Code Platforms

208,437

Code when you need it, UI when you don't — the workflow automation platform built for technical teams who refuse to choose.

View details
95
Repo Health
87
Technical
62
Dependency
Built with
TypeScript 92%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers