3๐
You need to import Chart from chart.js and not from Reacht-chartjs-2 to register it like so:
import {Chart} from 'chart.js';
import {Chart as ReactChart} from 'react-chartjs-2';
import StreamingPlugin from 'chartjs-plugin-streaming';
Chart.register(StreamingPlugin);
- [Chartjs]-How to show multiple values in point hover using chart.js
- [Chartjs]-Chart Js Cannot read property 'length' of undefined
0๐
Hi I found the answer because i had the same problem.
remove Chart from import react-chartjs-2
and import Chart from chart.js/auto so your imports would look like this.
import { Line } from "react-chartjs-2";
import "chartjs-adapter-luxon";
import StreamingPlugin from "chartjs-plugin-streaming";
import "./App.css";
import Chart from "chart.js/auto";
Chart.register(StreamingPlugin);```
Hope this helped.
-1๐
What worked for me was using chart.js@3.8.0
, chartjs-chart-geo@3.7.2
, and react-chartjs-2@4.1.0
. Like in this codepen.
Source:stackexchange.com