/** * @file Chart Node - Data visualization node for charts and graphs */ import * as React from "react"; import type { NodeDefinition, NodeRendererProps, InspectorRenderProps, ExternalDataReference, } from "../../../../../types/NodeDefinition"; import { getTextColor } from "./colorUtils"; export type ChartData = { id: string; type: "bar" | "line" | "pie"; title: string; data: Array<{ label: string; value: number; color?: string }>; }; export const ChartRenderer = ({ node, isSelected, isDragging, externalData }: NodeRendererProps) => { const chartData = externalData as ChartData | undefined; const renderMiniChart = () => { if (!chartData?.data) { return null; } const maxValue = Math.max(...chartData.data.map((d) => d.value)); const chartHeight = 60; switch (chartData.type) { case "bar": return (