3.4 KiB
3.4 KiB
Chart Pattern
- Status:
completed - Owner:
codex - Date:
2026-03-25
Goal
Add a reusable Chart pattern to @ai-ui/ui that can render the kind of dashboard trend panel
shown in the supplied reference: multi-series lines, soft area shading, an active point summary,
and a composable card-like review surface that still follows Cadence UI's current visual language.
Scope
- In scope:
- add a new
Chartcomponent topackages/ui - keep the first release focused on cartesian trend charts for dashboard analytics surfaces
- support multi-series rendering, optional area fills, axes, legend, and active-point callouts
- add Storybook stories, including a
Sales Impact-style showcase - add unit coverage for the public contract and interactive active-point behavior
- refresh repo status docs to reflect the shipped pattern
- add a new
- Out of scope:
- introducing a third-party charting dependency
- building a full visualization framework with bars, pies, heatmaps, and pivoting
- server-driven drilldown, zooming, panning, or data transforms outside the component
- adding the new story to the curated browser harness unless it becomes a required regression surface
Constraints
- Follow
DESIGN.mdover the raw screenshot when visual details conflict. - Reuse existing tokens, motion rules, and card-like surface styling instead of hardcoded brand treatments.
- Keep the API source-owned and narrow, similar to the
DataTablephilosophy. - Preserve stable
data-slotanddata-*hooks so docs and tests can target the component predictably.
Affected Surfaces
docs/exec-plans/2026-03-25-chart-pattern.mdpackages/ui/src/components/chart.tsxpackages/ui/src/components/chart.variants.tspackages/ui/src/components/chart.test.tsxpackages/ui/src/index.tsapps/docs/src/components/chart.stories.tsxREADME.mdroadmap.mdregistry/index.json
Plan
- Add an execution plan and update repo status docs for the new public pattern.
- Implement a source-owned
Chartcomponent that supports multi-series dashboard trend charts without adding an external chart library. - Add Storybook stories that explain anatomy and demonstrate a
Sales Impact-style analytics panel. - Add unit tests for slots, legend rendering, active-point updates, and controlled state.
- Run the narrowest useful validation suites, then record any remaining gaps.
Validation
pnpm test -- --runInBandpnpm harness:validate:docspnpm registry:build
Orchestration Task Sketch
T1: implement the Chart component and export surfaceT2 -> T1: add docs stories and validate the rendered showcaseT3 -> T1: add tests and registry updates
Status Log
2026-03-25 19:08Read the system-of-record files and confirmed the repo does not yet ship a chart pattern.2026-03-25 19:18Started the chart implementation plan for a new dashboard-focused analytics pattern.2026-03-25 19:42Implemented the newChartcomponent, public exports, stories, tests, and status-doc updates.2026-03-25 19:55Validatedpackages/uitypecheck, targeted chart tests, package builds, Storybook docs build, and registry generation.pnpm harness:validate:changedstill failed because the dirty worktree already contains unrelatedapps/docs/src/revenue-dashboard.stories.tsxtype errors and existingreact-refresh/only-export-componentswarnings inpackages/ui/src/components/context-menu.tsx.