/build-dashboard - Build Interactive Dashboards
If you see unfamiliar placeholders or need to check which tools are connected, see CONNECTORS.md.
Build a self-contained interactive HTML dashboard with charts, filters, tables, and professional styling. Opens directly in a browser -- no server or dependencies required.
Usage
Workflow
1. Understand the Dashboard Requirements
Determine:
- Purpose: Executive overview, operational monitoring, deep-dive analysis, team reporting
- Audience: Who will use this dashboard?
- Key metrics: What numbers matter most?
- Dimensions: What should users be able to filter or slice by?
- Data source: Live query, pasted data, CSV file, or sample data
2. Gather the Data
If data warehouse is connected:
- Query the necessary data
- Embed the results as JSON within the HTML file
If data is pasted or uploaded:
- Parse and clean the data
- Embed as JSON in the dashboard
If working from a description without data:
- Create a realistic sample dataset matching the described schema
- Note in the dashboard that it uses sample data
- Provide instructions for swapping in real data
3. Design the Dashboard Layout
Follow a standard dashboard layout pattern:
Adapt the layout to the content:
- 2-4 KPI cards at the top for headline numbers
- 1-3 charts in the middle section for trends and breakdowns
- Optional detail table at the bottom for drill-down data
- Filters in the header or sidebar depending on complexity
4. Build the HTML Dashboard
Generate a single self-contained HTML file using the base template below. The file includes:
Structure (HTML):
- Semantic HTML5 layout
- Responsive grid using CSS Grid or Flexbox
- Filter controls (dropdowns, date pickers, toggles)
- KPI cards with values and labels
- Chart containers
- Data table with sortable headers
Styling (CSS):
- Professional color scheme (clean whites, grays, with accent colors for data)
- Card-based layout with subtle shadows
- Consistent typography (system fonts for fast loading)
- Responsive design that works on different screen sizes
- Print-friendly styles
Interactivity (JavaScript):
- Chart.js for interactive charts (included via CDN)
- Filter dropdowns that update all charts and tables simultaneously
- Sortable table columns
- Hover tooltips on charts
- Number formatting (commas, currency, percentages)
Data (embedded JSON):
- All data embedded directly in the HTML as JavaScript variables
- No external data fetches required
- Dashboard works completely offline
5. Implement Chart Types
Use Chart.js for all charts. Common dashboard chart patterns:
- Line chart: Time series trends
- Bar chart: Category comparisons
- Doughnut chart: Composition (when <6 categories)
- Stacked bar: Composition over time
- Mixed (bar + line): Volume with rate overlay
Use the Chart.js integration patterns below for each chart type.
6. Add Interactivity
Use the filter and interactivity implementation patterns below for dropdown filters, date range filters, combined filter logic, sortable tables, and chart updates.
7. Save and Open
- Save the dashboard as an HTML file with a descriptive name (e.g.,
sales_dashboard.html) - Open it in the user's default browser
- Confirm it renders correctly
- Provide instructions for updating data or customizing
Base Template
Every dashboard follows this structure:
KPI Card Pattern
Chart.js Integration
Chart Container Pattern
Line Chart
Bar Chart
Doughnut Chart
Updating Charts on Filter Change
Filter and Interactivity Implementation
Dropdown Filter
Date Range Filter
Combined Filter Logic
Sortable Table
CSS Styling for Dashboards
Color System
Layout
KPI Cards
Chart Containers
Filters
Data Table
Responsive Design
Performance Considerations for Large Datasets
Data Size Guidelines
Pre-Aggregation Pattern
Instead of embedding raw data and aggregating in the browser:
Chart Performance
- Limit line charts to <500 data points per series (downsample if needed)
- Limit bar charts to <50 categories
- For scatter plots, cap at 1,000 points (use sampling for larger datasets)
- Disable animations for dashboards with many charts:
animation: falsein Chart.js options - Use
Chart.update('none')instead ofChart.update()for filter-triggered updates
DOM Performance
- Limit data tables to 100-200 visible rows. Add pagination for more.
- Use
requestAnimationFramefor coordinated chart updates - Avoid rebuilding the entire DOM on filter change -- update only changed elements
Examples
Tips
- Dashboards are fully self-contained HTML files -- share them with anyone by sending the file
- For real-time dashboards, consider connecting to a BI tool instead. These dashboards are point-in-time snapshots
- Request "dark mode" or "presentation mode" for different styling
- You can request a specific color scheme to match your brand
