Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsApr 11, 2026·2 min de lectura

Chart.js — Simple Yet Flexible HTML5 Canvas Charts

Chart.js is the most popular charting library for the web — simple HTML5 canvas charts with 8 built-in chart types, responsive, animated, and mixable. The go-to choice when you need beautiful charts with minimal setup.

Introducción

Chart.js is the most popular charting library for the web with over 67K GitHub stars. It renders 8 built-in chart types using the HTML5 <canvas> element — simple, responsive, and highly customizable. Trusted by millions of projects including Shopify, Apache, and countless dashboards.

What Chart.js Does

  • 8 chart types — line, bar, radar, doughnut/pie, polar area, bubble, scatter, area
  • Mixed charts — combine types (e.g. line + bar)
  • Responsive — auto-resize to container
  • Animations — configurable transitions
  • Interactivity — hover, click, tooltip
  • Plugins — annotations, data labels, zoom, drag-data, Chart.js-geo
  • Tree-shakeable — import only what you use

Architecture

Renders to a Canvas 2D context (not SVG). Chart instance holds config, data, options. Plugin hooks fire at each lifecycle stage (before/afterRender, tooltip, etc.). Datasets can be updated in place with chart.update().

Self-Hosting

Client library, no backend.

Key Features

  • 8 built-in chart types
  • Canvas-based (performant for large datasets)
  • Tree-shakeable imports
  • Rich plugin ecosystem
  • Responsive by default
  • Smooth animations
  • Customizable tooltips
  • First-party React wrapper (react-chartjs-2)

Comparison

Library Renderer Chart Types Bundle Customization
Chart.js Canvas 8 ~60KB Medium
ECharts Canvas/SVG 20+ ~350KB High
Recharts SVG (React) 10+ ~90KB Medium
D3 SVG/Canvas Any Modular Unlimited
Visx SVG (React+D3) Any Modular Unlimited

FAQ

Q: Canvas or SVG — which should I choose? A: Canvas is more performant (1000+ data points stay smooth); SVG makes it easier to manipulate individual elements. Chart.js went with Canvas for large datasets.

Q: How do I do real-time updates? A: Modify chart.data.datasets[0].data, then call chart.update("none") to skip the animation.

Q: How do I integrate with React? A: Use the react-chartjs-2 wrapper, which provides React components like <Line> and <Bar>.

Sources & Credits

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados