我试图将顶点图表与react和typescript一起使用,结果出现了以下错误:
没有与此调用匹配的重载。
重载2(共2个),“(props:props,context:any):ReactApexhart”,给出以下错误。
类型“{name:string;data:number;}”不可分配给类型“number”。
重载2(共2个),“(props:props,context:any):ReactApexhart”,给出以下错误。
类型“{name:string;data:number;}”不可分配给类型“number”。
重载2(共2个),“(props:props,context:any):ReactApexhart”,给出以下错误。
类型“{name:string;data:number;}”不可分配给类型“number”。
重载2(共2个),“(props:props,context:any):ReactApexhart”,给出以下错误。
类型“{name:string;data:number;}”不可分配给类型“number”。
这是.ts文件:
import Chart from "react-apexcharts";
import houses from "../jsons/students.json"
const BarChart = () => {
return(
<Chart
options={{
colors:["#55a1d3", "#eeb60b", "#d2232a", "#3dad47"],
xaxis: {
categories: [""],
labels: {
style: {
fontSize: "1px"
}
}
},
dataLabels: {
enabled: true,
style: {
fontFamily: "Montserrat",
fontWeight: "bold"
}
},
legend: {
fontFamily: "Montserrat",
fontSize: "14pt"
}
}}
series={[
{
name: "Pankhurst",
data: 3,
},
{
name: "Mee",
data: 3,
},
{
name: "Orwell",
data: 3,
},
{
name: "Hawking",
data: 3,
},
]}
type="bar"
height="100%"
width="100%"
/>
);
}
export default BarChart;