# Story 4.3: Dashboard de Résultats Interactif

Status: review

## Story

As a Julien (Analyst),
I want to see the model results through interactive charts,
so that I can easily diagnose the performance of my regression.

## Acceptance Criteria

1. **Results View:** A new "Results" tab or page displays the output of the regression.
2. **Metrics Cards:** Key statistics (R², Adj. R², P-value, Sample Size) are shown in high-visibility cards with Shadcn UI.
3. **Primary Chart:** A "Real vs Predicted" scatter chart with a reference 45-degree line.
4. **Diagnostic Chart:** A "Residuals Distribution" histogram or "Residuals vs Fitted" plot.
5. **Coefficient Table:** A clean table showing each predictor, its coefficient, and its p-value (color-coded for significance < 0.05).

## Tasks / Subtasks

- [x] **Visualization Development** (AC: 1, 3, 4)
  - [x] Create `frontend/src/features/analysis/components/AnalysisResults.tsx`.
  - [x] Implement "Real vs Predicted" chart using `Recharts`.
  - [x] Implement "Residuals" diagnostic chart.
- [x] **Data Integration** (AC: 2, 5)
  - [x] Update `useGridStore` to trigger the regression run and store `analysisResults`.
  - [x] Build the metrics summary UI and coefficient table.

## Dev Notes

- **Feedback:** Added visual error reporting in the UI if the regression fails.
- **Charts:** Used `ScatterChart` for real-vs-pred and `AreaChart` for residuals distribution.
- **UX:** Auto-switch to "Results" tab upon successful execution.

### Project Structure Notes

- Created `frontend/src/features/analysis/components/AnalysisResults.tsx`.
- Integrated results state in `frontend/src/store/use-grid-store.ts`.
- Updated `frontend/src/app/page.tsx` with robust error handling.

### References

- [Source: epics.md#Story 4.3]
- [Source: ux-design-specification.md#Design Directions]

## Dev Agent Record

### Agent Model Used

{{agent_model_name_version}}

### Completion Notes List
- Implemented `AnalysisResults` component with responsive charts.
- Added visual indicators for statistical significance.
- Verified correct state management flow from configuration to results display.
- Improved error handling and user feedback during execution.

### File List
- /frontend/src/features/analysis/components/AnalysisResults.tsx
- /frontend/src/store/use-grid-store.ts
- /frontend/src/app/page.tsx
- /frontend/src/features/analysis/components/AnalysisConfiguration.tsx