diff --git a/financial-data-analyst/app/api/finance/route.ts b/financial-data-analyst/app/api/finance/route.ts index 4b990bda..41c60b73 100644 --- a/financial-data-analyst/app/api/finance/route.ts +++ b/financial-data-analyst/app/api/finance/route.ts @@ -73,6 +73,7 @@ const tools: ToolSchema[] = [ footer: { type: "string" as const }, totalLabel: { type: "string" as const }, xAxisKey: { type: "string" as const }, + yAxisKey: { type: "string" as const }, }, required: ["title", "description"], }, @@ -270,6 +271,7 @@ For Time-Series (Line/Bar/Area): ], config: { xAxisKey: "period", + yAxisKey: "sales", title: "Quarterly Revenue", description: "Revenue growth over time" }, @@ -286,6 +288,7 @@ For Comparisons (MultiBar): ], config: { xAxisKey: "category", + yAxisKey: "sales", title: "Product Performance", description: "Sales vs Costs by Product" }, diff --git a/financial-data-analyst/components/ChartRenderer.tsx b/financial-data-analyst/components/ChartRenderer.tsx index 66c7d05a..6da38576 100644 --- a/financial-data-analyst/components/ChartRenderer.tsx +++ b/financial-data-analyst/components/ChartRenderer.tsx @@ -22,6 +22,7 @@ import { Pie, PieChart, XAxis, + YAxis } from "recharts"; import { ChartContainer, @@ -54,6 +55,17 @@ function BarChartComponent({ data }: { data: ChartData }) { : value; }} /> + { + return value.length > 20 + ? `${value.substring(0, 17)}...` + : value; + }} + /> } @@ -110,6 +122,17 @@ function MultiBarChartComponent({ data }: { data: ChartData }) { : value; }} /> + { + return value.length > 20 + ? `${value.substring(0, 17)}...` + : value; + }} + /> } @@ -176,6 +199,17 @@ function LineChartComponent({ data }: { data: ChartData }) { : value; }} /> + { + return value.length > 20 + ? `${value.substring(0, 17)}...` + : value; + }} + /> } @@ -342,6 +376,17 @@ function AreaChartComponent({ : value; }} /> + { + return value.length > 20 + ? `${value.substring(0, 17)}...` + : value; + }} + /> >; chartConfig: ChartConfig;