fix: Chart.js plugins are not register at each and every render (#303)

This commit is contained in:
Palash 2021-09-28 18:20:14 +05:30 committed by GitHub
parent 9ab1093d81
commit 93b5a945a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,23 @@ import { useThemeSwitcher } from 'react-css-theme-switcher';
// import Legends from './Legend';
// import { LegendsContainer } from './styles';
Chart.register(
LineElement,
PointElement,
LineController,
CategoryScale,
LinearScale,
TimeScale,
TimeSeriesScale,
Decimation,
Filler,
Legend,
Title,
Tooltip,
SubTitle,
BarController,
BarElement,
);
const Graph = ({
data,
@ -62,24 +79,6 @@ const Graph = ({
}
if (chartRef.current !== null) {
Chart.register(
LineElement,
PointElement,
LineController,
CategoryScale,
LinearScale,
TimeScale,
TimeSeriesScale,
Decimation,
Filler,
Legend,
Title,
Tooltip,
SubTitle,
BarController,
BarElement,
);
const options: ChartOptions = {
responsive: true,
maintainAspectRatio: false,