diff --git a/django_project/frontend/src/components/ChartCard.tsx b/django_project/frontend/src/components/ChartCard.tsx index 3aed4562..0e03ddce 100644 --- a/django_project/frontend/src/components/ChartCard.tsx +++ b/django_project/frontend/src/components/ChartCard.tsx @@ -34,16 +34,15 @@ const ChartCard: React.FC = ({ config, className }) => { const [newHeight, setNewHeight] = useState(cardHeight); const [chartType, setChartType] = useState('defaultChartType'); const [dashboardName, setDashboardName] = useState('defaultDashboardName'); - - useEffect(() => { - if (config?.config) { - setChartType(config.config.chartType); - setDashboardName(config.config.dashboardName); - } - }, [config]); - - // Check if config.chartType is "chart" or "map" - const isChart = config.config.preference === "chart"; + const [isChart, setIsChart] = useState(false); + + useEffect(() => { + if (config?.config) { + setChartType(config.config.chartType); + setDashboardName(config.config.dashboardName); + setIsChart(config.config.preference === "chart"); + } + }, [config]); const getChartComponent = () => { @@ -59,15 +58,6 @@ const ChartCard: React.FC = ({ config, className }) => { } try { - - // switch (chartType) { - // case "bar": - // return ; - // case "pie": - // return ; - // default: - // return ; - // } return } catch (error) { console.error("Error processing data:", error);