import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts'; import type { ChartDataPoint } from '@/lib/types'; import { getChartColors } from '../utils/chart-colors'; import { ChartTooltip } from '../primitives/chart-tooltip'; import { isPriceData, isOHLCVData } from '../utils/chart-data-transformers'; type LineChartViewProps = { data: ChartDataPoint[]; formatters?: { price?: (value: number) => string; date?: (value: string) => string; volume?: (value: number) => string; }; }; export function LineChartView({ data, formatters }: LineChartViewProps) { const colors = getChartColors(); const chartData = data.map(point => { if (isOHLCVData(point)) { return { date: point.date, price: point.close, open: point.open, high: point.high, low: point.low, close: point.close, volume: point.volume }; } else if (isPriceData(point)) { return { date: point.date, price: point.price }; } return point; }); return ( } cursor={{ stroke: colors.muted, strokeWidth: 1, strokeDasharray: '5 5' }} isAnimationActive={false} /> ); }