Chart Artifact
Chart Artifact
Generate burn rate charts and financial analysis through AI chat. Creates interactive visualizations from conversation.
Problems solved
- Generate burn-rate chart artifacts from financial chat requests
- Stream progressive chart data while analysis runs
- Compute runway and expense insights alongside the visualization
Use cases
- Startup burn-rate dashboards
- Finance copilots that plot runway
- Budget review chats with live charts
- Investor update visualization tools
Setup
Requirements, wiring steps, and what this pattern adds to your project.
Getting started
Pick how you want to pull this pattern in. Then wire env vars and routes the same way.
- 1
Download → Next.js app
Use Download → Next.js app in the preview toolbar. You get a zip scaffold (Pro downloads rewrite preview `/view/.../api/*` paths to `/api/*` automatically).
- 2
Extract the zip and install dependencies
Unzip the archive, then run `pnpm install` (or npm / yarn) in the project folder.
- 3
Fill .env.local
The download includes .env.local placeholders when needed. Add real values for: OPENAI_API_KEY.
- 4
Customize the agent and tool files
Adapt prompts, tools, and stop conditions in the generated project for your product.
- 5
Run the app and open the pattern route
Run `pnpm dev`, open the setup/checklist page if present, then navigate to the generated pattern route and verify responses.
Environment variables
OPENAI_API_KEYGet key
Capabilities
AI SDK APIs
streamTextconvertToModelMessagestoolProviders
External services
Files added
25 filesapp/page.tsxapp/layout.tsxapp/api/artifact/route.tscomponents/burn-rate-chat.tsxcomponents/expandable-panel.tsxcomponents/burn-rate-analysis-panel.tsxcomponents/burn-rate-chart.tsxcomponents/burn-rate-loading.tsxcomponents/left-panel-chat.tsxcomponents/message-input.tsxcomponents/message-list.tsxcomponents/chat-message-card.tsxcomponents/intro-heading.tsxcomponents/right-panel-artifact.tsxcomponents/right-panel-header.tsxcomponents/status-indicator.tsxcomponents/types.tshooks/use-artifact-panel-state.tsxhooks/use-burn-rate-artifact.tslib/error-handler.tslib/ai/context.tslib/ai/tools/index.tslib/ai/tools/burn-rate.tslib/ai/artifacts/burn-rate.tsREADME.md
Dependencies
18 totalnpm packages
9
Registry components
Critical files
artifact/route.tsAPI route for the burn rate chart artifact. Uses runWithContext for AsyncLocalStorage context, streamText with the analyzeBurnRate tool.
tools/burn-rate.tsImplements the analyzeBurnRateTool with a 4-stage progressive streaming pipeline: loading, processing, analyzing, and complete. Uses BurnRateArtifact.stream() for progressive UI updates.
artifacts/burn-rate.tsDefines BurnRateArtifact via artifact(). Zod schema captures: title, stage, currency, progress, chartData array, and optional summary with trends and alerts.
ai/context.tsAsyncLocalStorage-based context management for the chart artifact. Provides runWithContext, getContext, getWriter.
Requirements
- Complexity
- Intermediate
- Setup time
- ~15 minutes
- Node
- 24+
- Memory
- 512MB







