Chartjs-React-chartjs-2 cannot register plugin

0👍

You are trying to import chartjs as treeshaking while importing from the auto package, this does not work. Changing your import and register to this will solve the issue:

import React from "react";
import { Line } from "react-chartjs-2";
import Chart from "chart.js/auto";
import zoomPlugin from "chartjs-plugin-zoom";

Chart.register(zoomPlugin)

Leave a comment