diff --git a/frontend/src/pages/SqlExplorer.tsx b/frontend/src/pages/SqlExplorer.tsx index b76e8ba..659f36f 100644 --- a/frontend/src/pages/SqlExplorer.tsx +++ b/frontend/src/pages/SqlExplorer.tsx @@ -149,14 +149,40 @@ export function SqlExplorerPage() { ? result.rows.map((row) => { const yRaw = row[effectiveYCol]; const yNum = yRaw != null ? parseFloat(String(yRaw)) : NaN; - return { + const entry: Record = { x: row[effectiveXCol], y: isNaN(yNum) ? 0 : yNum, label: String(row[effectiveXCol] ?? ''), }; + // Attach all column values for rich tooltips + for (let i = 0; i < result.columns.length; i++) { + entry[`_col${i}`] = row[i]; + } + return entry; }) : []; + // Custom tooltip that shows all row values on hover + const renderTooltip = (props: { active?: boolean; payload?: Array<{ payload: Record }> }) => { + if (!props.active || !props.payload?.length || !result) return null; + const data = props.payload[0].payload; + return ( +
+ {result.columns.map((col, i) => { + const val = data[`_col${i}`]; + const isY = i === effectiveYCol; + const isX = i === effectiveXCol; + return ( +
+ {col.name}: + {val == null ? 'NULL' : String(val)} +
+ ); + })} +
+ ); + }; + // Split saved queries into pre-built (no id-based delete) and user-saved const preBuiltNames = new Set([ 'Company Overview', 'Recent Recommendations', 'High Confidence Buys', @@ -342,7 +368,7 @@ export function SqlExplorerPage() { - + ) : effectiveChartType === 'line' ? ( @@ -350,7 +376,7 @@ export function SqlExplorerPage() { - + ) : ( @@ -358,7 +384,7 @@ export function SqlExplorerPage() { - + )}