类型错误:无法读取未定义的属性(读取“toString”)(apex-charts)

Uil*_*mim 3 javascript sass next.js apexcharts

我当时正在开发一个个人项目,我正在考虑使用 apexcharts,但是图像中显示的错误开始出现,如果我在图表组件中设置宽度和高度属性,它就会消失,如果我将站点放入,它也会消失正在生产中,但目前我正在研究布局的响应能力

\n

1

\n
export function Chart() {\n    const Chart = dynamic(() => import("react-apexcharts"), { ssr: false });\n    const options: ApexOptions = {\n        chart: {\n            id: "chart",\n            background: "#030a4d8d",\n            fontFamily: "Roboto",\n            width: "auto",\n            height: "auto",\n            redrawOnWindowResize: true,\n            selection: {\n                enabled: false,\n            },\n            toolbar: {\n                show: false,\n            },\n        },\n        dataLabels: {\n            background: {\n                borderRadius: 10,\n            },\n            style: {\n                colors: ["#142085"],\n            },\n        },\n        colors: ["#7e838c", "#474d59", "#363b47"],\n        grid: {\n            show: false,\n        },\n        legend: {\n            fontFamily: "Roboto",\n        },\n        noData: {\n            text: "Nenhum dado encontrado",\n            style: {\n                fontFamily: "Roboto",\n            },\n        },\n        xaxis: {\n            categories: ["Sistemas", "Comandos", "Servidores"],\n            labels: {\n                style: {\n                    colors: "#f5f7fa",\n                    fontFamily: "Roboto",\n                },\n            },\n        },\n        yaxis: {\n            show: false,\n        },\n        series: [\n            {\n                data: [100, 200, 300],\n            },\n        ],\n        tooltip: {\n            enabled: false,\n        },\n    };\n\n    return (\n        <div className="chart-container">\n            <Chart\n                options={options}\n                series={options.series}\n                type="bar"\n                width={300}\n                height={150}\n            />\n        </div>\n    );\n}\n
Run Code Online (Sandbox Code Playgroud)\n

我已经尝试在组件中定义宽度并在 css 中对其进行样式设置,但组件的样式占主导地位,我是 \xe2\x80\x8b\xe2\x80 领域的初学者\x8bframeworks,我什至看不懂英文,我只是希望这个错误消失,而无需我在图表组件中定义宽度和高度属性

\n

Rag*_*rma 9

在图表组件中给出这样的宽度。

        <Chart
            options={options}
            series={options.series}
            type="bar"
            width={"100%"}
            height={150}
        />
    
Run Code Online (Sandbox Code Playgroud)