data-build-dashboard
When to use
Use this when the user wants an explorable dashboard rather than a static chart or a one-off number — a KPI overview, a metrics tracker, or a report others click through. Deliver one HTML file that opens in any browser with no server, build step, or network dependency.
Not for: a single publication chart (use data-create-viz), the analysis or recommendation behind the numbers (use data-analyze), or verifying the numbers are correct (use data-validate).
Method
- Define the decisions the dashboard supports. List the 3-6 KPIs that answer them and the dimensions users slice by (date, region, segment).
- Shape the data. Embed it inline as a JSON array in a
<script> block. Decision point: if raw rows exceed a few thousand, pre-aggregate rollups and keep raw rows only where filtering needs them — note the row count.
- Lay out top-down: KPI cards (with delta vs prior period) across the top, primary trend chart next, breakdown charts below, detail table last.
- Add interactivity: a date-range control and dimension filters that recompute every KPI and chart. Wire all filters through one shared
applyFilters() so state stays consistent.
- Style with a clean CSS system: responsive grid, readable type scale, palette that works in light and dark. One charting library via CDN with an offline fallback, or hand-rolled SVG.
- Self-test the numbers: totals must reconcile with the source before delivery.
Example
One filter function feeds every widget, so nothing drifts out of sync:
const DATA = [ /* ...inline rows... */ ];
function applyFilters() {
const rows = DATA.filter(r => r.date >= start.value && r.region === region.value);
renderKPIs(rows); // all widgets read the same filtered set
renderCharts(rows);
renderTable(rows);
}
[start, end, region].forEach(el => el.addEventListener("change", applyFilters));
applyFilters();
Pitfalls
- Embedding millions of raw rows, producing a multi-MB file that hangs the browser.
- Each chart filtering independently, so KPI cards and charts disagree.
- A CDN-only chart library with no fallback — the file breaks offline.
- Shipping without reconciling totals, so the dashboard looks polished but lies.
Output format
Deliverable: one self-contained .html (data + CSS + JS inline, works double-clicked offline)
Top: title, last-updated timestamp, KPI card row with period-over-period deltas
Middle: interactive filters + primary time-series chart
Bottom: breakdown charts + sortable detail table
Note: data source, refresh method, assumptions
State how to refresh the data.
1---2name: data-build-dashboard3version: 1.0.04description: Build a self-contained interactive HTML dashboard with KPI cards, charts, and filters that runs from a single offline file.5author: matrixx00706tags: [dashboard, html, visualization, interactive, reporting, kpi]7capabilities: []8metadata:9 source: https://skillmd.com/skills/matrixx0070/data-build-dashboard10---1112# data-build-dashboard1314## When to use1516Use this when the user wants an explorable dashboard rather than a static chart or a one-off number — a KPI overview, a metrics tracker, or a report others click through. Deliver one HTML file that opens in any browser with no server, build step, or network dependency.1718**Not for:** a single publication chart (use data-create-viz), the analysis or recommendation behind the numbers (use data-analyze), or verifying the numbers are correct (use data-validate).1920## Method21221. **Define the decisions** the dashboard supports. List the 3-6 KPIs that answer them and the dimensions users slice by (date, region, segment).232. **Shape the data.** Embed it inline as a JSON array in a `<script>` block. Decision point: if raw rows exceed a few thousand, pre-aggregate rollups and keep raw rows only where filtering needs them — note the row count.243. **Lay out top-down:** KPI cards (with delta vs prior period) across the top, primary trend chart next, breakdown charts below, detail table last.254. **Add interactivity:** a date-range control and dimension filters that recompute every KPI and chart. Wire all filters through one shared `applyFilters()` so state stays consistent.265. **Style** with a clean CSS system: responsive grid, readable type scale, palette that works in light and dark. One charting library via CDN with an offline fallback, or hand-rolled SVG.276. **Self-test** the numbers: totals must reconcile with the source before delivery.2829## Example3031One filter function feeds every widget, so nothing drifts out of sync:3233```js34const DATA = [ /* ...inline rows... */ ];35function applyFilters() {36 const rows = DATA.filter(r => r.date >= start.value && r.region === region.value);37 renderKPIs(rows); // all widgets read the same filtered set38 renderCharts(rows);39 renderTable(rows);40}41[start, end, region].forEach(el => el.addEventListener("change", applyFilters));42applyFilters();43```4445## Pitfalls4647- Embedding millions of raw rows, producing a multi-MB file that hangs the browser.48- Each chart filtering independently, so KPI cards and charts disagree.49- A CDN-only chart library with no fallback — the file breaks offline.50- Shipping without reconciling totals, so the dashboard looks polished but lies.5152## Output format5354```55Deliverable: one self-contained .html (data + CSS + JS inline, works double-clicked offline)56Top: title, last-updated timestamp, KPI card row with period-over-period deltas57Middle: interactive filters + primary time-series chart58Bottom: breakdown charts + sortable detail table59Note: data source, refresh method, assumptions60```6162State how to refresh the data.