我试图呈现一个简单的图表,它是工作正常的酒吧组件,但当我改变到甜甜圈组件或任何其他组件,然后它呈现一个空白的白色页面
import { Box } from "@chakra-ui/react";
import React from "react";
import { Pie, Bar, Line, Doughnut } from "react-chartjs-2";
function Donutchart() {
return (
<Box maxH={400} maxWidth={600}>
<Doughnut
options={{
responsive: true,
plugins: {
title: {
display: false,
},
},
maintainAspectRatio: false,
}}
data={{
labels: ["Energy", "envi", "retail", "govt"],
datasets: [
{
label: "Sector",
data: [54, 36, 12, 45],
backgroundColor: "rgba(53, 162, 235, 0.5)",
},
],
}}
height={400}
width={600}
/>
</Box>
);
}
export default Donutchart;
1条答案
按热度按时间kiayqfof1#
也可以尝试这样导入寄存器
我希望这对你有帮助