Skip to content
Discussion options

You must be logged in to vote

This is by design in Chart.js v3+. The library moved to a tree-shakable architecture, which means components are no longer auto-registered globally.

In v2, everything was bundled and registered automatically. In v3/v4, you have two options:

Option 1: Register only what you need (your current approach)

import { Chart, CategoryScale, LinearScale, LineController, PointElement, LineElement } from "chart.js";
Chart.register(CategoryScale, LinearScale, LineController, PointElement, LineElement);

Option 2: Register everything at once

import Chart from "chart.js/auto";

The chart.js/auto import registers all controllers, scales, and elements for you — which is essentially the v2 behavior. It is si…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by TWDBrob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants