"use client"; import React from "react"; import { BarChart } from "./BarChart"; import { HorizontalBarChart } from "./HorizontalBarChart"; import { LineChart } from "./LineChart"; import { AreaChart } from "./AreaChart"; import { PieChart } from "./PieChart"; import { StackedBarChart } from "./StackedBarChart"; import { ComboChart } from "./ComboChart"; import { ChartConfig, ChartData, ElementSubtype } from "../types"; interface ChartProps { chartType: ElementSubtype; data: ChartData; config: ChartConfig; width?: number; height?: number; } /** * 통합 차트 컴포넌트 * - 차트 타입에 따라 적절한 D3 차트 컴포넌트를 렌더링 */ export function Chart({ chartType, data, config, width, height }: ChartProps) { // 데이터가 없으면 placeholder 표시 if (!data || !data.labels.length || !data.datasets.length) { return (
📊
데이터를 설정하세요
차트 설정에서 데이터 소스와 축을 설정하세요
); } // 차트 타입에 따라 렌더링 switch (chartType) { case "bar": return ; case "horizontal-bar": return ; case "line": return ; case "area": return ; case "pie": return ; case "donut": return ; case "stacked-bar": return ; case "combo": return ; default: return (
지원하지 않는 차트 타입
{chartType}
); } }