[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69BH8C4R6D6ETR0HKWAYCDX":3,"skill-same:01M69BH8C4R6D6ETR0HKWAYCDX":109},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":55,"linkOnly":56,"markdownContent":57,"markdownBody":58,"frontMatter":59,"refName":60,"commitSha":61,"skillDirectory":62,"forksCount":63,"repositoryHtmlUrl":64,"repositoryHomepageUrl":17,"ownerHtmlUrl":65,"ownerBlogUrl":66,"ownerDescription":67,"updatedAt":68,"install":69,"resources":82},"01M69BH8C4R6D6ETR0HKWAYCDX","visuals","仪表盘图表与可视化设计","Use when adding charts, KPIs, tables, slicers, or any visual to a dashboard. Charts are authored as Graphein chart specs — one chart = one JSON `ChartSpec` (type + tidy `data` + `encoding`) dropped into `\u003CChartCard spec={…} \u002F>`, which owns loading \u002F empty \u002F error and the app theme. Covers the spec model and the per-type recipes (line\u002Farea\u002Fbar\u002Fscatter\u002Fpie\u002Fheatmap\u002Ffunnel\u002Fcombo\u002Fhistogram\u002F treemap\u002Fgauge\u002Fbullet\u002Fwaterfall\u002FcalendarHeatmap\u002Fslope\u002Fdumbbell\u002Ftable\u002Fmatrix), declarative features (transform\u002Fannotations\u002Finsights\u002Ftrendline\u002Ffacet), the validate→repair→report self-check (graphein 0.16), headless preview against live data, the DAX→rows helpers (toChartData \u002F toTable \u002F topN \u002F deriveKpi), `KpiCard`, `DataTableCard` (Graphein table\u002Fmatrix), slicers (dropdown\u002Flist\u002Fsearch\u002Fdate-range\u002Frange + FilterBar) with shared filter state, interactivity, layout, value formatting, and color tokens.","在向仪表盘添加图表、KPI、表格、切片器或任何可视化元素时使用。图表以 Graphein 图表规范编写——每张图表即一个 JSON `ChartSpec`（类型 + 整洁的 `data` + `encoding`），放入 `\u003CChartCard spec={…} \u002F>` 中，由该组件负责加载态、空态、错误态以及应用主题。涵盖规范模型与各类图表配方（折线\u002F面积\u002F柱形\u002F散点\u002F饼图\u002F热力图\u002F漏斗\u002F组合\u002F直方图\u002F树图\u002F仪表盘\u002F子弹图\u002F瀑布图\u002F日历热力图\u002F斜率图\u002F哑铃图\u002F表格\u002F矩阵）、声明式特性（transform\u002Fannotations\u002Finsights\u002Ftrendline\u002Ffacet）、validate→repair→report 自检（graphein 0.16）、基于实时数据的无头预览、DAX→rows 辅助函数（toChartData \u002F toTable \u002F topN \u002F deriveKpi）、`KpiCard`、`DataTableCard`（Graphein table\u002Fmatrix）、切片器（dropdown\u002Flist\u002Fsearch\u002Fdate-range\u002Frange 及 FilterBar）与共享筛选状态、交互、布局、数值格式化及颜色令牌。","microsoft\u002Fawesome-rayfin","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M69BFJTNT39H6W8XT2H1BZDN",114,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Funiversal-app\u002F.agents\u002Fskills\u002Fvisuals\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQGD4CMBM6B4PWSM1NXGT9","数据分析与报告","SCENARIO","使用场景",[5,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54],"self","when","headless","which","insights","loading","error","filter","facet","chart","calendarheatmap","app","shared","spec","preview","model","tidy","Charts","search","headless preview","report","dax","validate","dashboard","2026-11-10 10:12:30",false,"---\nname: visuals\ndescription: >\n  Use when adding charts, KPIs, tables, slicers, or any visual to a dashboard.\n  Charts are authored as Graphein chart specs — one chart = one JSON `ChartSpec`\n  (type + tidy `data` + `encoding`) dropped into `\u003CChartCard spec={…} \u002F>`, which\n  owns loading \u002F empty \u002F error and the app theme. Covers the spec model and the\n  per-type recipes (line\u002Farea\u002Fbar\u002Fscatter\u002Fpie\u002Fheatmap\u002Ffunnel\u002Fcombo\u002Fhistogram\u002F\n  treemap\u002Fgauge\u002Fbullet\u002Fwaterfall\u002FcalendarHeatmap\u002Fslope\u002Fdumbbell\u002Ftable\u002Fmatrix),\n  declarative features (transform\u002Fannotations\u002Finsights\u002Ftrendline\u002Ffacet), the\n  validate→repair→report self-check (graphein 0.16), headless preview against live\n  data, the DAX→rows helpers (toChartData \u002F toTable \u002F topN \u002F deriveKpi), `KpiCard`,\n  `DataTableCard` (Graphein table\u002Fmatrix), slicers (dropdown\u002Flist\u002Fsearch\u002Fdate-range\u002Frange + FilterBar)\n  with shared filter state, interactivity, layout, value formatting, and color tokens.\n---\n\n# Visuals — author a Graphein spec, drop it in a tile\n\n**One chart = one JSON spec.** You don't hand-write SVG or wire a charting\nlibrary. You (1) map your DAX result into plain rows, (2) author a single Graphein\n[`ChartSpec`](references\u002Fgraphein-spec-reference.md) — a `type`, a tidy `data`\narray, and an `encoding` that names the columns — and (3) drop it into\n`\u003CChartCard spec={…} \u002F>`. The card owns the loading \u002F empty \u002F error states and\nbridges the app theme, so a spec never needs a color or a size.\n\n> **Charts are `graphein` 0.16.** That means a broad chart catalog (combo\u002Fdual-axis,\n> histogram, treemap, gauge, bullet, waterfall, calendar-heatmap, slope, dumbbell\n> on top of the classics), in-spec **transforms** and **annotations** (reference\n> lines), and a **self-correcting loop** — `validateSpec` → `repairSpec` →\n> `summarize` plus a render **report**. Render each visual spec **headlessly\n> against live data** to a PNG + report before ship: see the **headless-preview**\n> skill. This is the agent validation loop; KPI\u002Ftable\u002Fmatrix\u002Fslicers\u002Fdashboard\n> rasterize to PNG too, so preview-validate every visual before shipping.\n\nThree things are React surfaces around Graphein specs or state:\n\n- **KPIs** → `\u003CKpiCard>` (big value + delta pill + sparkline).\n- **Tabular data** → `\u003CDataTableCard spec={tableOrMatrixSpec}>` (Graphein\n  `table` \u002F `matrix` — virtualized, sortable, conditional formatting, totals).\n- **Filters** → the **slicers** (`FilterBar` + `DropdownSlicer`\u002F…) over shared\n  filter state; chart selections can bridge into the same state.\n\nEverything is exported from one barrel: **`@\u002Fcomponents\u002Fdashboard`**.\n\n## Fast path\n\nOptimize *time to wow*: ship one real tile, preview, user review, iterate.\n\n**Phase 1 — Hero slice:** render ONE real visual the simplest way — map the hero\nquery with `toChartData(...)`, author a spec, pass it to a `ChartCard`. Pass\n`loading` \u002F `error` straight from the query hook. That's enough to ship.\n\n```tsx\nimport { ChartCard, toChartData } from \"@\u002Fcomponents\u002Fdashboard\";\nimport { useSemanticModelQuery } from \"@\u002Fhooks\u002Fuse-semantic-model-query\";\n\nconst { data, isLoading, error } = useSemanticModelQuery({ connection, query });\n\n\u003CChartCard\n  title=\"Revenue\"\n  subtitle=\"Last 12 months\"\n  loading={isLoading}\n  error={error}\n  spec={{\n    type: \"line\",\n    data: toChartData(data, { columns: { month: \"Date[Month]\", revenue: \"Total Revenue\" } }),\n    points: true,\n    encoding: {\n      x: { field: \"month\", type: \"temporal\" },\n      y: { field: \"revenue\", type: \"quantitative\", format: \"$,.0f\" },\n    },\n  }}\n\u002F>\n```\n\n**Phase 2 — Breadth:** add the rest (metric band, more charts, a `DataTableCard`),\nwrapped in `PageShell` + `StatStrip` + `DashboardGrid`\u002F`Tile`. Preview each\nvisual as you add it before automatic ship.\n\n**Phase 3 — Polish:** slicers, interactivity, multi-series, formatting, dark-mode\nreview.\n\n## The data flow (map → author → drop in)\n\nEvery tile follows the same shape:\n\n1. **Fetch** with `useSemanticModelQuery({ connection, query })` →\n   `{ data, isLoading, error }` (see the `dax` + `fabric-data` skills).\n2. **Map** the DAX result into the shape the visual wants. Helpers accept the\n   query result, a raw `QueryTable`, or `undefined` — no `status` check:\n   - **Charts** want **tidy\u002Flong rows** → `toChartData(result, options?)`.\n   - **Tables** want a Graphein `table` spec → `toTable(result, { columns })`.\n     Hand-author a `matrix` spec over `toChartData(result)` rows for pivots.\n3. **Author + pass.** Put rows in a spec's `data` and hand the spec to the card\n   with `loading` + `error`. Don't pre-render skeletons\u002Fempty states — the cards do it.\n\n```tsx\n\u002F\u002F DAX rows are positional (unknown[][]); toChartData keys them by column\n\u002F\u002F (short) name and coerces numerics. Prefer explicit aliases for stable keys\n\u002F\u002F (and when two columns share a short name, e.g. Date[Month] + Ship[Month]):\nconst rows = toChartData(data, {\n  columns: { month: \"Date[Month]\", revenue: \"Total Revenue\" },\n});\n\u002F\u002F rows → [{ month: \"2024-01\", revenue: 84200 }, …]\n```\n\n### Keep data tidy — split with `series`, don't pre-pivot\n\nGraphein wants **long\u002Ftidy** data: one row per observation. To show multiple\nseries (multi-line, grouped\u002Fstacked bars, stacked areas), add a `series` channel\nthat points at the category column — **do not** widen the table into one column\nper category.\n\n```jsonc\n\u002F\u002F ✅ tidy — one row per (quarter, channel); split with series\n[{ \"quarter\": \"Q1\", \"channel\": \"Online\", \"revenue\": 210 },\n { \"quarter\": \"Q1\", \"channel\": \"Retail\", \"revenue\": 180 }]\n\u002F\u002F encoding: { x:{field:\"quarter\"}, y:{field:\"revenue\"}, series:{field:\"channel\"} }\n```\n\n`toChartData` already returns long rows, so a normal DAX result drops straight in.\n(`pivotChartData` still exists for the rare case you truly need wide rows, but with\nGraphein you almost never do.)\n\n## Authoring a spec\n\nA spec is a plain JSON object — no functions, no colors, no sizes:\n\n```jsonc\n{\n  \"type\": \"bar\",                       \u002F\u002F the discriminator\n  \"data\": [ \u002F* tidy rows *\u002F ],         \u002F\u002F required for every type\n  \"encoding\": {                        \u002F\u002F names the columns → visual channels\n    \"x\": { \"field\": \"quarter\" },\n    \"y\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n    \"series\": { \"field\": \"channel\" }\n  },\n  \"stack\": true                        \u002F\u002F per-type option\n}\n```\n\n- **`encoding` is required** for `line`\u002F`area`\u002F`bar`\u002F`scatter` (`x`+`y`), `pie`\n  (`theta`+`color`), `heatmap` (`x`+`y`+`color`), `funnel`\u002F`waterfall`\n  (`stage`\u002F`value`), `treemap` (`category`+`value`), `calendarHeatmap`\n  (`date`+`color`), `dumbbell` (`category`+`value`+`group`), and `combo` (`x` +\n  per-layer `y`). `gauge`\u002F`bullet` take a `value` (not `encoding`).\n  `FieldDef.type` is `quantitative | temporal | ordinal | nominal` (inferred when omitted).\n- **Validate → repair → render.** `validateSpec(spec)` → `{ valid, errors, warnings }`\n  catches field-name typos and bad shapes; `repairSpec(spec)` auto-fixes many of\n  them (returns the patched spec). Both are re-exported from the barrel. See\n  **Self-check** below and the **headless-preview** skill. When a spec still\n  renders wrong, set `debug: true` on it to swap the chart for a diagnostic view\n  (live preview + resolved spec + data sample + validation + render report);\n  clear the flag to render normally.\n- **Don't author `theme`.** `ChartCard` injects the app's CSS-token theme (brand\n  color + dark mode) automatically. Recolor via `src\u002Fglobal.css` tokens, never\n  per-spec hex.\n\n### Pick a type\n\n| Goal | `type` | Key channels \u002F options |\n|---|---|---|\n| Trend over time | `line` (`area` to emphasize volume) | `x` temporal, `y`, optional `series`; `points`, `curve` |\n| Part-to-whole over time | `area` + `stack: true` | `x`, `y`, `series` |\n| Compare categories | `bar` | `x` category, `y`, optional `series`; `stack` or grouped |\n| Two measures, different scales | `combo` (dual-axis) | `encoding.x` + `layers[]` each `{ mark, encoding.y, axis: \"left\"\\|\"right\" }` |\n| Stage conversion | `funnel` | `stage`, `value`, optional `percent: \"first\" \\| \"previous\"` |\n| Running total \u002F bridge | `waterfall` | `stage`, `value` (signed); `totals` for absolute bars |\n| Composition of a total | `bar` + `stack`, or `pie`\u002Fdonut | bar: `series`; pie: `theta` + `color`, `donut`, `labels` |\n| Nested part-to-whole | `treemap` | `category`, `value`, optional `group`, `color` |\n| Correlation \u002F 3rd dim | `scatter` | `x`, `y`, optional `size`, `series`; `trendline` |\n| Distribution of one measure | `histogram` | `x` (binned); `bin` controls |\n| Density across two categories | `heatmap` | `x`, `y`, `color`, `scheme` |\n| Value over a calendar | `calendarHeatmap` | `date`, `color`, `scheme` |\n| Single value vs target\u002Frange | `gauge` \u002F `bullet` | `value` (+ `min`\u002F`max`; bullet adds `target`) |\n| Before\u002Fafter, two points per row | `dumbbell` | `category`, `value`, `group` (2 levels) |\n| Rank change between two periods | `slope` | `x` (2 values), `y`, `series` |\n| Headline metric | **`KpiCard`** (React) | not a Graphein chart spec — see Cards |\n| Raw \u002F detail records | **`DataTableCard`** with `table` spec | `toTable(result, { columns })`; see Cards |\n| Pivot \u002F cross-tab | **`DataTableCard`** with `matrix` spec | `rows`, `columns`, `values`, totals, conditional formatting |\n\nRules of thumb: prefer `bar` over `pie` beyond ~6 slices; `stack` for\npart-to-whole, grouped bars for direct comparison; `combo` only when two measures\ngenuinely share an x but need different y-scales (don't reach for it by default).\n\n### Recipes (mirror the gallery)\n\n```jsonc\n\u002F\u002F Multi-series line — points + currency Y, split by metric\n{ \"type\": \"line\", \"data\": rows, \"points\": true,\n  \"encoding\": { \"x\": { \"field\": \"month\", \"type\": \"temporal\" },\n                \"y\": { \"field\": \"value\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"series\": { \"field\": \"metric\" } } }\n\n\u002F\u002F Stacked area — quarterly channel mix\n{ \"type\": \"area\", \"data\": rows, \"stack\": true,\n  \"encoding\": { \"x\": { \"field\": \"quarter\", \"type\": \"ordinal\" },\n                \"y\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"series\": { \"field\": \"channel\" } } }\n\n\u002F\u002F Grouped bars (drop `stack` for grouped; add it to stack)\n{ \"type\": \"bar\", \"data\": rows, \"stack\": true,\n  \"encoding\": { \"x\": { \"field\": \"quarter\" },\n                \"y\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"series\": { \"field\": \"channel\" } } }\n\n\u002F\u002F Ranked bars — sort rows by value first (add \"orientation\":\"horizontal\" for long labels)\n{ \"type\": \"bar\", \"data\": topN(rows, \"revenue\", 8),\n  \"encoding\": { \"x\": { \"field\": \"region\", \"type\": \"nominal\" },\n                \"y\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.2s\" } } }\n\n\u002F\u002F Bubble scatter — size = a third measure\n{ \"type\": \"scatter\", \"data\": rows,\n  \"encoding\": { \"x\": { \"field\": \"price\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"y\": { \"field\": \"units\", \"type\": \"quantitative\" },\n                \"size\": { \"field\": \"margin\", \"title\": \"Margin\" } } }\n\n\u002F\u002F Donut — theta = value, color = category\n{ \"type\": \"pie\", \"data\": rows, \"donut\": 0.6,\n  \"encoding\": { \"theta\": { \"field\": \"value\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"color\": { \"field\": \"category\" } } }\n\n\u002F\u002F Pie with outside callout labels\n{ \"type\": \"pie\", \"data\": rows,\n  \"labels\": { \"placement\": \"outside\", \"content\": \"category-percent\", \"minShare\": 0.03, \"connector\": \"muted\" },\n  \"encoding\": { \"theta\": { \"field\": \"value\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"color\": { \"field\": \"category\" } } }\n\n\u002F\u002F Funnel — ordered stage conversion, labels show % vs previous stage\n{ \"type\": \"funnel\", \"data\": rows, \"labels\": true, \"percent\": \"previous\",\n  \"encoding\": { \"stage\": { \"field\": \"stage\" },\n                \"value\": { \"field\": \"users\", \"type\": \"quantitative\", \"format\": \",d\" } } }\n\n\u002F\u002F Heatmap — category × category, colored by a measure\n{ \"type\": \"heatmap\", \"data\": rows, \"scheme\": \"teal\",\n  \"encoding\": { \"x\": { \"field\": \"quarter\" }, \"y\": { \"field\": \"region\" },\n                \"color\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.2s\" } } }\n\n\u002F\u002F Combo (dual-axis) — bars on the left scale, a line on the right\n{ \"type\": \"combo\", \"data\": rows,\n  \"encoding\": { \"x\": { \"field\": \"month\", \"type\": \"temporal\" } },\n  \"layers\": [\n    { \"mark\": \"bar\",  \"axis\": \"left\",  \"encoding\": { \"y\": { \"field\": \"revenue\", \"format\": \"$,.0f\" } } },\n    { \"mark\": \"line\", \"axis\": \"right\", \"encoding\": { \"y\": { \"field\": \"margin\",  \"format\": \".0%\" } } } ] }\n\n\u002F\u002F Histogram — distribution of one measure (auto-binned)\n{ \"type\": \"histogram\", \"data\": rows, \"bin\": { \"maxbins\": 20 },\n  \"encoding\": { \"x\": { \"field\": \"orderValue\", \"type\": \"quantitative\", \"format\": \"$,.0f\" } } }\n\n\u002F\u002F Treemap — nested part-to-whole (group → category sized by value)\n{ \"type\": \"treemap\", \"data\": rows,\n  \"encoding\": { \"category\": { \"field\": \"product\" }, \"value\": { \"field\": \"revenue\", \"format\": \"$,.0f\" },\n                \"group\": { \"field\": \"category\" } } }\n\n\u002F\u002F Waterfall — running total of signed changes; mark absolute bars with `totals`\n{ \"type\": \"waterfall\", \"data\": rows, \"totals\": [\"Start\", \"End\"],\n  \"encoding\": { \"stage\": { \"field\": \"stage\" }, \"value\": { \"field\": \"delta\", \"format\": \"$,.0f\" } } }\n\n\u002F\u002F Gauge \u002F bullet — a single value vs a max (bullet adds a target)\n{ \"type\": \"gauge\",  \"data\": [row], \"min\": 0, \"max\": 100, \"value\": { \"field\": \"score\" } }\n{ \"type\": \"bullet\", \"data\": [row], \"value\": { \"field\": \"actual\" }, \"target\": { \"field\": \"goal\" },\n  \"encoding\": { \"label\": { \"field\": \"metric\" } } }\n\n\u002F\u002F Dumbbell — two points per category (e.g. last year vs this year)\n{ \"type\": \"dumbbell\", \"data\": rows,\n  \"encoding\": { \"category\": { \"field\": \"region\" }, \"value\": { \"field\": \"revenue\", \"format\": \"$,.0f\" },\n                \"group\": { \"field\": \"year\" } } }\n\n\u002F\u002F Reference line + auto-insights (declarative, no extra data)\n{ \"type\": \"line\", \"data\": rows, \"insights\": true,\n  \"annotations\": [ { \"type\": \"line\", \"value\": 100, \"label\": \"Target\" } ],\n  \"encoding\": { \"x\": { \"field\": \"month\", \"type\": \"temporal\" },\n                \"y\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.0f\" } } }\n```\n\nFull field-by-field docs + every channel\u002Foption:\n[Graphein spec reference](references\u002Fgraphein-spec-reference.md).\n\n### Declarative features (graphein 0.16)\n\nReshape and enrich a chart **inside the spec** — no pre-massaging the data, no\nsecond chart. All are plain JSON and render headlessly:\n\n- **`transform`** — an in-spec pipeline run before the chart builds: `aggregate`\n  (group + sum\u002Fmean\u002F…), `bin`, `filter`, `fold` (wide→long), `timeUnit`,\n  `calculate`. Lets encodings reference fields the pipeline produces.\n  ```jsonc\n  { \"type\": \"bar\", \"data\": rows,\n    \"transform\": [{ \"aggregate\": [{ \"op\": \"sum\", \"field\": \"revenue\", \"as\": \"total\" }], \"groupby\": [\"region\"] }],\n    \"encoding\": { \"x\": { \"field\": \"region\" }, \"y\": { \"field\": \"total\", \"format\": \"$,.0f\" } } }\n  ```\n- **`annotations`** — reference **lines**, **bands**, threshold **zones**, and\n  **point** callouts overlaid on the plot. A `y`-axis line uses `value` (a `band`\n  uses `from`\u002F`to`; a `point` uses `x`+`y`):\n  `\"annotations\": [{ \"type\": \"line\", \"value\": 100, \"label\": \"Target\" }]`.\n- **`insights: true`** — auto-mark the notable points (max\u002Fmin; opt into\n  `outliers`) so you never hardcode where the peak is.\n- **`trendline: true`** — overlay a linear line of best fit (on `scatter`\u002F`line`).\n- **`facet: { field }`** — split into a trellis of small multiples, one panel per\n  category, on shared scales.\n\n### Self-check before ship\n\nGraphein 0.16 can critique its own specs — use it to iterate before ship:\n\n- **`validateSpec(spec)` → `{ valid, errors, warnings }`** — path-pointed errors +\n  soft warnings. **`repairSpec(spec)` → `{ spec, applied, remaining }`** auto-fixes\n  many mistakes (apply `applied` to your source). **`summarize(spec)` → string** —\n  a one-line read of what the chart says (sanity-check the trend).\n- **Render it against live data** — `npm run preview -- --spec s.json --query \u003Calias>\n  --dax-file q.dax` writes a themed PNG **and** a report (`ok`, `diagnostics` for\n  clipping\u002Foverlap\u002Fcontrast, mark\u002Fseries\u002Fcolor counts). View the PNG, read the\n  report, fix, repeat — then drop the spec into a `\u003CChartCard>`. Full loop +\n  flags: the **headless-preview** skill. KPI\u002Ftable\u002Fmatrix\u002Fslicers\u002Fdashboard\n  rasterize to PNG too, so preview-validate them before shipping.\n\n### Gotchas\n\n- **Horizontal bars are supported** — set `orientation: \"horizontal\"` on a `bar`\n  spec (keep `encoding.x` = category, `encoding.y` = value; the renderer swaps the\n  axes). For \"top N\" \u002F ranked breakdowns still sort rows by value\n  (`topN(rows, key, n)`); horizontal reads best when category labels are long. For\n  a category comparison of two points (e.g. before\u002Fafter), use a **`dumbbell`**.\n- **Reference lines & combo charts now exist** (0.15). Use `annotations: [{ type:\n  \"line\", value }]` for a target\u002Fthreshold line, and the `combo` type for two\n  measures on different y-scales — don't fake either with stacked `ChartCard`s.\n- **Temporal fields are ISO strings** (`\"2024-01\"`, `\"2024-01-15\"`) or epoch ms —\n  JSON has no `Date`. Mark the field `type: \"temporal\"` for a time axis.\n- **Empty `data` → empty tile.** A spec with `data: []` makes `ChartCard` show\n  its empty state. Never ship mock\u002Fplaceholder rows in the real app — the one\n  exception is the clearly-labeled bundled demo under `src\u002Fdemo\u002F**`, which you\n  delete when you wire the real model.\n\n## Cards\n\n### `ChartCard`\nThe card shell — rounded-2xl, hairline border, no shadow — in two modes:\n\n```tsx\n\u002F\u002F Spec mode (the common case): pass a Graphein spec + query state.\n\u003CChartCard title=\"Revenue\" subtitle=\"Last 12 months\"\n  loading={isLoading} error={error} spec={spec} \u002F>\n\n\u002F\u002F Children mode: own the body (e.g. a slicer, custom content).\n\u003CChartCard title=\"Filters\">\u003CListSlicer … \u002F>\u003C\u002FChartCard>\n```\n\nProps: `eyebrow`, `title`, `subtitle`, `action` (right-aligned header slot),\n`variant` (`\"surface\" | \"feature\" | \"outline\" | \"ghost\"`), `accent`\n(thin left spine; use chart tokens like `\"chart-1\"`), `spec`, `height` (omit\nfor responsive aspect-based height; table\u002Fmatrix specs auto-use a fixed scroll\nheight), `isEmpty` (force empty; defaults to detecting empty `spec.data`),\n`store`, `onSelectionChange`, `footer`, `loading`, `error`, `emptyMessage`,\n`onRetry`, `bodyClassName`, `children`.\n\n### `KpiCard`\nHero metric tile: big formatted value, colored delta pill, optional accent dot \u002F\nbadge \u002F icon, an optional `variant`, and an inline `trend` sparkline. Prefer\n`StatStrip` for the top KPI header; use `KpiCard` for standalone metrics.\n\n```tsx\n\u003CKpiCard\n  label=\"Revenue\"\n  data={rows} valueKey=\"revenue\"   \u002F\u002F …or a literal `value={341500}`\n  valueFormat=\"currency\"\n  delta={9.2}                       \u002F\u002F signed PERCENT-scale number → +9.2% pill\n  deltaLabel=\"vs last month\"\n  trend={rows.map((r) => r.revenue)} \u002F\u002F sparkline; auto-derives delta if omitted\n  invertDelta={false}               \u002F\u002F true when down-is-good (cost, churn)\n\u002F>\n```\n\nPass a literal `value` **or** `data` + `valueKey` (reads **only the first row** — feed a single-row measure result or a\nprecomputed `value`, not a multi-row table you expect it to aggregate). With no\nvalue it renders the empty state — never a fake `0`. `delta` is a **percent\nnumber** (`9.2` → `+9.2%`), not a fraction. Use `deriveKpi(result, { valueKey })`\nto get `{ value, previous, delta, trend }` from a time series in one call.\n\n> **Empty card with data present?** `valueKey` must match a mapped column name\n> **exactly** (case-sensitive). Alias columns in `toChartData({ columns: … })`\n> for stable keys; in dev the console prints the available keys.\n\n### `DataTableCard`\nA Graphein `table` \u002F `matrix` in the card shell — virtualized, sortable, themed,\nwith conditional formatting, groups, and totals. Build a table spec with\n`toTable(result, { columns })`; hand-author a `matrix` over `toChartData(result)`\nrows for a pivot\u002Fcross-tab.\n\n```tsx\nconst table = toTable(data, {\n  columns: [\n    { field: \"account\", source: \"Customer[Account]\", title: \"Account\" },\n    { field: \"revenue\", source: \"Revenue\", title: \"Revenue\", format: \"$,.0f\", align: \"right\",\n      conditionalFormat: { type: \"bar\", showValue: true } },\n  ],\n  sort: { field: \"revenue\", order: \"desc\" },\n  totals: { label: \"Total\" },\n});\n\n\u003CDataTableCard title=\"Top accounts\" loading={isLoading} error={error}\n  spec={table} height={420} \u002F>\n```\n\nProps: `spec` (`TableSpec | MatrixSpec`), `height` (default `360`), `store`,\n`onSelectionChange`, `isEmpty`, plus the shared card state props (`title`,\n`subtitle`, `action`, `loading`, `error`, `emptyMessage`, `onRetry`). See\n[formatting & color](references\u002Fformatting.md) and the\n[Graphein spec reference](references\u002Fgraphein-spec-reference.md) for table\u002Fmatrix\nfields.\n\n## Interactivity\n\nGraphein specs can publish and consume named selections:\n\n- `params` publishes a `point` or `interval` selection (click marks or brush).\n- `highlight` consumes a selection by emphasizing matches and dimming the rest.\n- `filter` consumes selections or literal predicates by subsetting rows.\n\n```jsonc\n\u002F\u002F Bar publishes a region pick; line consumes it as a highlight.\n{ \"type\":\"bar\", \"data\":rows,\n  \"params\":[{ \"name\":\"pick\", \"select\":{ \"type\":\"point\", \"fields\":[\"region\"] } }],\n  \"encoding\":{ \"x\":{\"field\":\"region\"}, \"y\":{\"field\":\"revenue\"} } }\n{ \"type\":\"line\", \"data\":rows, \"highlight\":{ \"param\":\"pick\" },\n  \"encoding\":{ \"x\":{\"field\":\"month\",\"type\":\"temporal\"}, \"y\":{\"field\":\"revenue\"}, \"series\":{\"field\":\"region\"} } }\n```\n\nUse `SelectionStoreProvider` \u002F `useSelectionStore()` and pass the same `store` to\nseveral `ChartCard`s or `DataTableCard`s for cross-highlight\u002Fcross-filter. The\n**default is Power BI–style**: `useCrossHighlight(field)` + spreading\n`crossHighlightParams(param, fields)` into the source spec makes a click dim that\nchart's own unpicked marks while every other tile re-queries — feed the source\n`applyFilters(rows, pick.own(selections))` and others `toDaxFilters(selections)`.\nFor a manual bridge, call `useSelectionFilterBridge(store, { fieldMap })`: it maps\nGraphein selections into `useFilterState`, which drives `applyFilters` and\n`toDaxFilters`. React slicers + DAX re-query remain the primary filter path because\nthis app's tiles are independently DAX-aggregated per tile.\n\n## Shape helpers (DAX → rows\u002Fspecs)\n\n- **`toChartData(result, { columns? })`** → tidy rows for a spec's `data`. Alias\n  columns for stable keys.\n- **`toTable(result, { columns, sort, totals, density, striped, numeric, text })`**\n  → a Graphein `table` spec for `DataTableCard`. `columns` are Graphein table\n  columns plus optional `source` (full `Table[Col]`, short name, or index).\n- **`topN(rows, valueKey, n, { other?, ascending? })`** — sort + slice mapped\n  rows for ranked bars \u002F leaderboards, with an optional `\"Other\"` rollup.\n- **`deriveKpi(result, { valueKey })`** → `{ value, previous, delta, trend }` for\n  a `KpiCard`.\n\n## Layout\n\nDefault to the new flat, non-uniform dashboard path: `PageShell` → `StatStrip` →\n`DashboardGrid` + `Tile`. Build hierarchy with layout, surfaces, borders, accent\nedges, and typography — **no gradients or shadows**.\n\n```tsx\nimport {\n  PageShell, ThemeToggle,\n  StatStrip, Stat,\n  DashboardGrid, Tile,\n  ChartCard, DataTableCard,\n} from \"@\u002Fcomponents\u002Fdashboard\";\n\n\u003CPageShell eyebrow=\"Sales\" title=\"Revenue overview\" subtitle=\"FY24\" actions={\u003CThemeToggle \u002F>}>\n  \u003CStatStrip>\n    \u003CStat label=\"Revenue\" data={rows} valueKey=\"revenue\" valueFormat=\"currency\" accent=\"chart-1\" delta={12.4} \u002F>\n    \u003CStat label=\"Orders\" data={rows} valueKey=\"orders\" delta={3.1} \u002F>\n    \u003CStat label=\"Avg order\" value={84.2} valueFormat=\"currency\" delta={-1.2} \u002F>\n  \u003C\u002FStatStrip>\n\n  \u003CDashboardGrid>\n    \u003CTile size=\"hero\">\u003CChartCard title=\"Revenue trend\" className=\"h-full\" variant=\"feature\" accent=\"chart-1\" spec={lineSpec} \u002F>\u003C\u002FTile>\n    \u003CTile size=\"md\">\u003CChartCard title=\"By region\" spec={barSpec} \u002F>\u003C\u002FTile>\n    \u003CTile size=\"md\">\u003CChartCard title=\"Channel mix\" spec={pieSpec} \u002F>\u003C\u002FTile>\n    \u003CTile size=\"full\">\u003CDataTableCard title=\"Detail\" spec={tableSpec} \u002F>\u003C\u002FTile>\n  \u003C\u002FDashboardGrid>\n\u003C\u002FPageShell>\n```\n\n- **Frames:** `PageShell` is the default; `SidebarShell` adds an in-content\n  filter\u002Fcontext `rail` for filter-heavy analytics; `AppShell` is the flexible\n  lower-level frame for custom mastheads, `toolbar`, or `rail` composition.\n- **Metric header:** `StatStrip` + `Stat` is one bordered, hairline-divided band\n  of 2–5 metrics. Prefer it over four look-alike `KpiCard`s at the top.\n- **Grid:** `DashboardGrid` is the responsive 12-col canvas. Use `Tile size`:\n  `\"sm\"` 3, `\"md\"` 4, `\"lg\"` 6, `\"wide\"` 8, `\"hero\"` 8×2, `\"full\"` 12.\n  Mix sizes for editorial rhythm; do **not** default to a uniform grid. A `hero`\n  tile needs `className=\"h-full\"` on the card inside (it spans 2 rows; without it\n  the card sits at its natural height and leaves the lower row blank). Two `md`\n  tiles right after a `hero` stack to fill its remaining 4-col × 2-row corner.\n- **Zones\u002Fcards:** `SectionBand` creates alternate-surface (`surface-2`) zones.\n  `Card`, `ChartCard`, and `KpiCard` use flat variants (`\"surface\" | \"feature\" |\n  \"outline\" | \"ghost\"`); `Card`\u002F`ChartCard` also take `accent` for a thin left\n  spine. Use chart tokens such as `\"chart-1\"`, not raw colors.\n- **Legacy:** `KpiGrid`, `ChartGrid`, `BentoGrid`, and `BentoItem` still exist for\n  back-compat, but avoid them by default in new dashboards.\n\n## Controls & slicers (interactivity)\n\nChart specs can now publish selections, but React slicers remain the primary\nserver-side filter path in this app: they update shared filter state, which then\nre-filters client rows or re-queries DAX.\n\n**Lightweight controls** — own the value in `useState`, filter your rows:\n\n```tsx\nconst [range, setRange] = useState(\"30d\");\n\u003CSegmentedControl value={range} onChange={setRange}\n  options={[{ label: \"7D\", value: \"7d\" }, { label: \"30D\", value: \"30d\" }]} \u002F>\n```\n\n`SegmentedControl\u003CT>` (single-select pills) · `FilterChips\u003CT>` (multi-select chips).\n\n**Power BI-style slicers** — wire one **shared filter model**. **The starter\nalready mounts a `FilterBar` of slicers in the `PageShell` toolbar, wrapped in\n`\u003CFilterStateProvider>`** — feed real options and apply the selections; you\nrarely need to add the provider yourself. Every slicer reads\u002Fwrites the same\nselections. **Apply** them with `applyFilters(rows, selections)` (instant,\nclient-side) or `toDaxFilters(selections)` (re-query the model — see `dax`).\n\n```tsx\n\u003CFilterStateProvider>\n  \u003CFilterBar>\n    \u003CDropdownSlicer label=\"Category\" field=\"Product[Category]\" options={catOptions} \u002F>\n    \u003CDateRangeSlicer label=\"Date\" field=\"Date[Date]\" \u002F>\n    \u003CRangeSlicer label=\"Price\" field=\"Product[Price]\" min={0} max={1000} \u002F>\n  \u003C\u002FFilterBar>\n  \u003CRevenueByRegion \u002F>   {\u002F* reads useFilterState() → applyFilters(rows, selections) *\u002F}\n\u003C\u002FFilterStateProvider>\n```\n\nSlicers: `DropdownSlicer`, `ListSlicer`, `SearchSlicer`, `DateRangeSlicer`,\n`RangeSlicer`, `FilterBar`. Fetch distinct values with\n`useSlicerOptions({ connection, field, … })`. Full guide:\n[slicers & filter state](references\u002Fslicers.md).\n\n## Formatting & color\n\n- **In a spec:** format numbers\u002Fdates with Graphein's\n  [format mini-language](references\u002Fformatting.md) on a `FieldDef` —\n  `\"$,.0f\"`, `\",d\"`, `\".1%\"`, `\".2s\"` (→ `1.2k`), `\"%b %e, %Y\"` (dates).\n- **Pie labels:** use `labels` (`placement: \"outside\"` for callouts,\n  `content: \"category-percent\"`, etc.).\n- **KpiCard:** `valueFormat` — `\"number\" | \"compact\" | \"currency\" | \"percent\"\n  (0–100) | \"ratio\" (0–1)` or a `(n) => string` function.\n- **Table\u002Fmatrix:** column\u002Fvalue `format` plus `conditionalFormat` (`bar`, `icon`,\n  `colorScale`, `rules`).\n- **Color\u002Ftheme:** never put hex in a spec — `ChartCard` themes every chart from\n  `src\u002Fglobal.css` tokens (`--color-chart-1..10`, accent, dark mode). Restyle by\n  editing those tokens. See [formatting & color](references\u002Fformatting.md).\n\n## State tiles\n\nUsed internally by the cards; use directly only for custom content.\n\n- **`EmptyTile`** (`message`, `icon`, `height`) · **`ErrorTile`** (`error`,\n  `title`, `onRetry`, `height`) · **`ChartSkeleton`** \u002F **`KpiSkeleton`** ·\n  **`TileBody`** (error → loading → empty → children switchboard).\n\n## Import surface\n\n```tsx\nimport {\n  \u002F\u002F layout + controls\n  AppShell, PageShell, SidebarShell, DashboardGrid, Tile, StatStrip, Stat,\n  SectionBand, Section, Card, ThemeToggle, SegmentedControl, FilterChips,\n  \u002F\u002F legacy layout (back-compat; avoid by default)\n  KpiGrid, ChartGrid, BentoGrid, BentoItem,\n  \u002F\u002F slicers + shared filter state\n  FilterStateProvider, useFilterState, FilterBar,\n  DropdownSlicer, ListSlicer, SearchSlicer, DateRangeSlicer, RangeSlicer,\n  useSlicerOptions, applyFilters, toDaxFilters,\n  \u002F\u002F cards + Graphein runtime\n  ChartCard, KpiCard, DataTableCard, Chart, validateSpec, createSelectionStore,\n  SelectionStoreProvider, useSelectionStore, useSelection, type ChartSpec,\n  \u002F\u002F selection bridge\n  useSelectionFilterBridge, selectionToFilters, filterToSelection,\n  useCrossHighlight, crossHighlightParams, selectionsExcept,\n  \u002F\u002F state tiles + sparkline\n  EmptyTile, ErrorTile, ChartSkeleton, KpiSkeleton, TileBody, Sparkline,\n  \u002F\u002F DAX → rows\u002Fspec helpers + formatting\u002Fcolor\n  toChartData, toTable, topN, deriveKpi, pivotChartData,\n  formatNumber, formatCompact, formatCurrency, formatPercent, formatDate,\n  seriesColor, roleColor,\n} from \"@\u002Fcomponents\u002Fdashboard\";\n```\n\n## References\n\n- [Graphein spec reference](references\u002Fgraphein-spec-reference.md) — every chart\u002Ftable\n  type, channel, and option, with copy-paste JSON.\n- [Formatting & color](references\u002Fformatting.md) — the format mini-language,\n  `valueFormat`, table\u002Fmatrix formats, conditional formatting, theme tokens.\n- [Slicers & filter state](references\u002Fslicers.md) · [interactions](references\u002Finteractions.md).\n- [Multiple data inputs](references\u002Fmulti-data-input.md) ·\n  [choosing the closest type](references\u002Fcustom-charts.md).\n","# Visuals — author a Graphein spec, drop it in a tile\n\n**One chart = one JSON spec.** You don't hand-write SVG or wire a charting\nlibrary. You (1) map your DAX result into plain rows, (2) author a single Graphein\n[`ChartSpec`](references\u002Fgraphein-spec-reference.md) — a `type`, a tidy `data`\narray, and an `encoding` that names the columns — and (3) drop it into\n`\u003CChartCard spec={…} \u002F>`. The card owns the loading \u002F empty \u002F error states and\nbridges the app theme, so a spec never needs a color or a size.\n\n> **Charts are `graphein` 0.16.** That means a broad chart catalog (combo\u002Fdual-axis,\n> histogram, treemap, gauge, bullet, waterfall, calendar-heatmap, slope, dumbbell\n> on top of the classics), in-spec **transforms** and **annotations** (reference\n> lines), and a **self-correcting loop** — `validateSpec` → `repairSpec` →\n> `summarize` plus a render **report**. Render each visual spec **headlessly\n> against live data** to a PNG + report before ship: see the **headless-preview**\n> skill. This is the agent validation loop; KPI\u002Ftable\u002Fmatrix\u002Fslicers\u002Fdashboard\n> rasterize to PNG too, so preview-validate every visual before shipping.\n\nThree things are React surfaces around Graphein specs or state:\n\n- **KPIs** → `\u003CKpiCard>` (big value + delta pill + sparkline).\n- **Tabular data** → `\u003CDataTableCard spec={tableOrMatrixSpec}>` (Graphein\n  `table` \u002F `matrix` — virtualized, sortable, conditional formatting, totals).\n- **Filters** → the **slicers** (`FilterBar` + `DropdownSlicer`\u002F…) over shared\n  filter state; chart selections can bridge into the same state.\n\nEverything is exported from one barrel: **`@\u002Fcomponents\u002Fdashboard`**.\n\n## Fast path\n\nOptimize *time to wow*: ship one real tile, preview, user review, iterate.\n\n**Phase 1 — Hero slice:** render ONE real visual the simplest way — map the hero\nquery with `toChartData(...)`, author a spec, pass it to a `ChartCard`. Pass\n`loading` \u002F `error` straight from the query hook. That's enough to ship.\n\n```tsx\nimport { ChartCard, toChartData } from \"@\u002Fcomponents\u002Fdashboard\";\nimport { useSemanticModelQuery } from \"@\u002Fhooks\u002Fuse-semantic-model-query\";\n\nconst { data, isLoading, error } = useSemanticModelQuery({ connection, query });\n\n\u003CChartCard\n  title=\"Revenue\"\n  subtitle=\"Last 12 months\"\n  loading={isLoading}\n  error={error}\n  spec={{\n    type: \"line\",\n    data: toChartData(data, { columns: { month: \"Date[Month]\", revenue: \"Total Revenue\" } }),\n    points: true,\n    encoding: {\n      x: { field: \"month\", type: \"temporal\" },\n      y: { field: \"revenue\", type: \"quantitative\", format: \"$,.0f\" },\n    },\n  }}\n\u002F>\n```\n\n**Phase 2 — Breadth:** add the rest (metric band, more charts, a `DataTableCard`),\nwrapped in `PageShell` + `StatStrip` + `DashboardGrid`\u002F`Tile`. Preview each\nvisual as you add it before automatic ship.\n\n**Phase 3 — Polish:** slicers, interactivity, multi-series, formatting, dark-mode\nreview.\n\n## The data flow (map → author → drop in)\n\nEvery tile follows the same shape:\n\n1. **Fetch** with `useSemanticModelQuery({ connection, query })` →\n   `{ data, isLoading, error }` (see the `dax` + `fabric-data` skills).\n2. **Map** the DAX result into the shape the visual wants. Helpers accept the\n   query result, a raw `QueryTable`, or `undefined` — no `status` check:\n   - **Charts** want **tidy\u002Flong rows** → `toChartData(result, options?)`.\n   - **Tables** want a Graphein `table` spec → `toTable(result, { columns })`.\n     Hand-author a `matrix` spec over `toChartData(result)` rows for pivots.\n3. **Author + pass.** Put rows in a spec's `data` and hand the spec to the card\n   with `loading` + `error`. Don't pre-render skeletons\u002Fempty states — the cards do it.\n\n```tsx\n\u002F\u002F DAX rows are positional (unknown[][]); toChartData keys them by column\n\u002F\u002F (short) name and coerces numerics. Prefer explicit aliases for stable keys\n\u002F\u002F (and when two columns share a short name, e.g. Date[Month] + Ship[Month]):\nconst rows = toChartData(data, {\n  columns: { month: \"Date[Month]\", revenue: \"Total Revenue\" },\n});\n\u002F\u002F rows → [{ month: \"2024-01\", revenue: 84200 }, …]\n```\n\n### Keep data tidy — split with `series`, don't pre-pivot\n\nGraphein wants **long\u002Ftidy** data: one row per observation. To show multiple\nseries (multi-line, grouped\u002Fstacked bars, stacked areas), add a `series` channel\nthat points at the category column — **do not** widen the table into one column\nper category.\n\n```jsonc\n\u002F\u002F ✅ tidy — one row per (quarter, channel); split with series\n[{ \"quarter\": \"Q1\", \"channel\": \"Online\", \"revenue\": 210 },\n { \"quarter\": \"Q1\", \"channel\": \"Retail\", \"revenue\": 180 }]\n\u002F\u002F encoding: { x:{field:\"quarter\"}, y:{field:\"revenue\"}, series:{field:\"channel\"} }\n```\n\n`toChartData` already returns long rows, so a normal DAX result drops straight in.\n(`pivotChartData` still exists for the rare case you truly need wide rows, but with\nGraphein you almost never do.)\n\n## Authoring a spec\n\nA spec is a plain JSON object — no functions, no colors, no sizes:\n\n```jsonc\n{\n  \"type\": \"bar\",                       \u002F\u002F the discriminator\n  \"data\": [ \u002F* tidy rows *\u002F ],         \u002F\u002F required for every type\n  \"encoding\": {                        \u002F\u002F names the columns → visual channels\n    \"x\": { \"field\": \"quarter\" },\n    \"y\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n    \"series\": { \"field\": \"channel\" }\n  },\n  \"stack\": true                        \u002F\u002F per-type option\n}\n```\n\n- **`encoding` is required** for `line`\u002F`area`\u002F`bar`\u002F`scatter` (`x`+`y`), `pie`\n  (`theta`+`color`), `heatmap` (`x`+`y`+`color`), `funnel`\u002F`waterfall`\n  (`stage`\u002F`value`), `treemap` (`category`+`value`), `calendarHeatmap`\n  (`date`+`color`), `dumbbell` (`category`+`value`+`group`), and `combo` (`x` +\n  per-layer `y`). `gauge`\u002F`bullet` take a `value` (not `encoding`).\n  `FieldDef.type` is `quantitative | temporal | ordinal | nominal` (inferred when omitted).\n- **Validate → repair → render.** `validateSpec(spec)` → `{ valid, errors, warnings }`\n  catches field-name typos and bad shapes; `repairSpec(spec)` auto-fixes many of\n  them (returns the patched spec). Both are re-exported from the barrel. See\n  **Self-check** below and the **headless-preview** skill. When a spec still\n  renders wrong, set `debug: true` on it to swap the chart for a diagnostic view\n  (live preview + resolved spec + data sample + validation + render report);\n  clear the flag to render normally.\n- **Don't author `theme`.** `ChartCard` injects the app's CSS-token theme (brand\n  color + dark mode) automatically. Recolor via `src\u002Fglobal.css` tokens, never\n  per-spec hex.\n\n### Pick a type\n\n| Goal | `type` | Key channels \u002F options |\n|---|---|---|\n| Trend over time | `line` (`area` to emphasize volume) | `x` temporal, `y`, optional `series`; `points`, `curve` |\n| Part-to-whole over time | `area` + `stack: true` | `x`, `y`, `series` |\n| Compare categories | `bar` | `x` category, `y`, optional `series`; `stack` or grouped |\n| Two measures, different scales | `combo` (dual-axis) | `encoding.x` + `layers[]` each `{ mark, encoding.y, axis: \"left\"\\|\"right\" }` |\n| Stage conversion | `funnel` | `stage`, `value`, optional `percent: \"first\" \\| \"previous\"` |\n| Running total \u002F bridge | `waterfall` | `stage`, `value` (signed); `totals` for absolute bars |\n| Composition of a total | `bar` + `stack`, or `pie`\u002Fdonut | bar: `series`; pie: `theta` + `color`, `donut`, `labels` |\n| Nested part-to-whole | `treemap` | `category`, `value`, optional `group`, `color` |\n| Correlation \u002F 3rd dim | `scatter` | `x`, `y`, optional `size`, `series`; `trendline` |\n| Distribution of one measure | `histogram` | `x` (binned); `bin` controls |\n| Density across two categories | `heatmap` | `x`, `y`, `color`, `scheme` |\n| Value over a calendar | `calendarHeatmap` | `date`, `color`, `scheme` |\n| Single value vs target\u002Frange | `gauge` \u002F `bullet` | `value` (+ `min`\u002F`max`; bullet adds `target`) |\n| Before\u002Fafter, two points per row | `dumbbell` | `category`, `value`, `group` (2 levels) |\n| Rank change between two periods | `slope` | `x` (2 values), `y`, `series` |\n| Headline metric | **`KpiCard`** (React) | not a Graphein chart spec — see Cards |\n| Raw \u002F detail records | **`DataTableCard`** with `table` spec | `toTable(result, { columns })`; see Cards |\n| Pivot \u002F cross-tab | **`DataTableCard`** with `matrix` spec | `rows`, `columns`, `values`, totals, conditional formatting |\n\nRules of thumb: prefer `bar` over `pie` beyond ~6 slices; `stack` for\npart-to-whole, grouped bars for direct comparison; `combo` only when two measures\ngenuinely share an x but need different y-scales (don't reach for it by default).\n\n### Recipes (mirror the gallery)\n\n```jsonc\n\u002F\u002F Multi-series line — points + currency Y, split by metric\n{ \"type\": \"line\", \"data\": rows, \"points\": true,\n  \"encoding\": { \"x\": { \"field\": \"month\", \"type\": \"temporal\" },\n                \"y\": { \"field\": \"value\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"series\": { \"field\": \"metric\" } } }\n\n\u002F\u002F Stacked area — quarterly channel mix\n{ \"type\": \"area\", \"data\": rows, \"stack\": true,\n  \"encoding\": { \"x\": { \"field\": \"quarter\", \"type\": \"ordinal\" },\n                \"y\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"series\": { \"field\": \"channel\" } } }\n\n\u002F\u002F Grouped bars (drop `stack` for grouped; add it to stack)\n{ \"type\": \"bar\", \"data\": rows, \"stack\": true,\n  \"encoding\": { \"x\": { \"field\": \"quarter\" },\n                \"y\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"series\": { \"field\": \"channel\" } } }\n\n\u002F\u002F Ranked bars — sort rows by value first (add \"orientation\":\"horizontal\" for long labels)\n{ \"type\": \"bar\", \"data\": topN(rows, \"revenue\", 8),\n  \"encoding\": { \"x\": { \"field\": \"region\", \"type\": \"nominal\" },\n                \"y\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.2s\" } } }\n\n\u002F\u002F Bubble scatter — size = a third measure\n{ \"type\": \"scatter\", \"data\": rows,\n  \"encoding\": { \"x\": { \"field\": \"price\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"y\": { \"field\": \"units\", \"type\": \"quantitative\" },\n                \"size\": { \"field\": \"margin\", \"title\": \"Margin\" } } }\n\n\u002F\u002F Donut — theta = value, color = category\n{ \"type\": \"pie\", \"data\": rows, \"donut\": 0.6,\n  \"encoding\": { \"theta\": { \"field\": \"value\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"color\": { \"field\": \"category\" } } }\n\n\u002F\u002F Pie with outside callout labels\n{ \"type\": \"pie\", \"data\": rows,\n  \"labels\": { \"placement\": \"outside\", \"content\": \"category-percent\", \"minShare\": 0.03, \"connector\": \"muted\" },\n  \"encoding\": { \"theta\": { \"field\": \"value\", \"type\": \"quantitative\", \"format\": \"$,.0f\" },\n                \"color\": { \"field\": \"category\" } } }\n\n\u002F\u002F Funnel — ordered stage conversion, labels show % vs previous stage\n{ \"type\": \"funnel\", \"data\": rows, \"labels\": true, \"percent\": \"previous\",\n  \"encoding\": { \"stage\": { \"field\": \"stage\" },\n                \"value\": { \"field\": \"users\", \"type\": \"quantitative\", \"format\": \",d\" } } }\n\n\u002F\u002F Heatmap — category × category, colored by a measure\n{ \"type\": \"heatmap\", \"data\": rows, \"scheme\": \"teal\",\n  \"encoding\": { \"x\": { \"field\": \"quarter\" }, \"y\": { \"field\": \"region\" },\n                \"color\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.2s\" } } }\n\n\u002F\u002F Combo (dual-axis) — bars on the left scale, a line on the right\n{ \"type\": \"combo\", \"data\": rows,\n  \"encoding\": { \"x\": { \"field\": \"month\", \"type\": \"temporal\" } },\n  \"layers\": [\n    { \"mark\": \"bar\",  \"axis\": \"left\",  \"encoding\": { \"y\": { \"field\": \"revenue\", \"format\": \"$,.0f\" } } },\n    { \"mark\": \"line\", \"axis\": \"right\", \"encoding\": { \"y\": { \"field\": \"margin\",  \"format\": \".0%\" } } } ] }\n\n\u002F\u002F Histogram — distribution of one measure (auto-binned)\n{ \"type\": \"histogram\", \"data\": rows, \"bin\": { \"maxbins\": 20 },\n  \"encoding\": { \"x\": { \"field\": \"orderValue\", \"type\": \"quantitative\", \"format\": \"$,.0f\" } } }\n\n\u002F\u002F Treemap — nested part-to-whole (group → category sized by value)\n{ \"type\": \"treemap\", \"data\": rows,\n  \"encoding\": { \"category\": { \"field\": \"product\" }, \"value\": { \"field\": \"revenue\", \"format\": \"$,.0f\" },\n                \"group\": { \"field\": \"category\" } } }\n\n\u002F\u002F Waterfall — running total of signed changes; mark absolute bars with `totals`\n{ \"type\": \"waterfall\", \"data\": rows, \"totals\": [\"Start\", \"End\"],\n  \"encoding\": { \"stage\": { \"field\": \"stage\" }, \"value\": { \"field\": \"delta\", \"format\": \"$,.0f\" } } }\n\n\u002F\u002F Gauge \u002F bullet — a single value vs a max (bullet adds a target)\n{ \"type\": \"gauge\",  \"data\": [row], \"min\": 0, \"max\": 100, \"value\": { \"field\": \"score\" } }\n{ \"type\": \"bullet\", \"data\": [row], \"value\": { \"field\": \"actual\" }, \"target\": { \"field\": \"goal\" },\n  \"encoding\": { \"label\": { \"field\": \"metric\" } } }\n\n\u002F\u002F Dumbbell — two points per category (e.g. last year vs this year)\n{ \"type\": \"dumbbell\", \"data\": rows,\n  \"encoding\": { \"category\": { \"field\": \"region\" }, \"value\": { \"field\": \"revenue\", \"format\": \"$,.0f\" },\n                \"group\": { \"field\": \"year\" } } }\n\n\u002F\u002F Reference line + auto-insights (declarative, no extra data)\n{ \"type\": \"line\", \"data\": rows, \"insights\": true,\n  \"annotations\": [ { \"type\": \"line\", \"value\": 100, \"label\": \"Target\" } ],\n  \"encoding\": { \"x\": { \"field\": \"month\", \"type\": \"temporal\" },\n                \"y\": { \"field\": \"revenue\", \"type\": \"quantitative\", \"format\": \"$,.0f\" } } }\n```\n\nFull field-by-field docs + every channel\u002Foption:\n[Graphein spec reference](references\u002Fgraphein-spec-reference.md).\n\n### Declarative features (graphein 0.16)\n\nReshape and enrich a chart **inside the spec** — no pre-massaging the data, no\nsecond chart. All are plain JSON and render headlessly:\n\n- **`transform`** — an in-spec pipeline run before the chart builds: `aggregate`\n  (group + sum\u002Fmean\u002F…), `bin`, `filter`, `fold` (wide→long), `timeUnit`,\n  `calculate`. Lets encodings reference fields the pipeline produces.\n  ```jsonc\n  { \"type\": \"bar\", \"data\": rows,\n    \"transform\": [{ \"aggregate\": [{ \"op\": \"sum\", \"field\": \"revenue\", \"as\": \"total\" }], \"groupby\": [\"region\"] }],\n    \"encoding\": { \"x\": { \"field\": \"region\" }, \"y\": { \"field\": \"total\", \"format\": \"$,.0f\" } } }\n  ```\n- **`annotations`** — reference **lines**, **bands**, threshold **zones**, and\n  **point** callouts overlaid on the plot. A `y`-axis line uses `value` (a `band`\n  uses `from`\u002F`to`; a `point` uses `x`+`y`):\n  `\"annotations\": [{ \"type\": \"line\", \"value\": 100, \"label\": \"Target\" }]`.\n- **`insights: true`** — auto-mark the notable points (max\u002Fmin; opt into\n  `outliers`) so you never hardcode where the peak is.\n- **`trendline: true`** — overlay a linear line of best fit (on `scatter`\u002F`line`).\n- **`facet: { field }`** — split into a trellis of small multiples, one panel per\n  category, on shared scales.\n\n### Self-check before ship\n\nGraphein 0.16 can critique its own specs — use it to iterate before ship:\n\n- **`validateSpec(spec)` → `{ valid, errors, warnings }`** — path-pointed errors +\n  soft warnings. **`repairSpec(spec)` → `{ spec, applied, remaining }`** auto-fixes\n  many mistakes (apply `applied` to your source). **`summarize(spec)` → string** —\n  a one-line read of what the chart says (sanity-check the trend).\n- **Render it against live data** — `npm run preview -- --spec s.json --query \u003Calias>\n  --dax-file q.dax` writes a themed PNG **and** a report (`ok`, `diagnostics` for\n  clipping\u002Foverlap\u002Fcontrast, mark\u002Fseries\u002Fcolor counts). View the PNG, read the\n  report, fix, repeat — then drop the spec into a `\u003CChartCard>`. Full loop +\n  flags: the **headless-preview** skill. KPI\u002Ftable\u002Fmatrix\u002Fslicers\u002Fdashboard\n  rasterize to PNG too, so preview-validate them before shipping.\n\n### Gotchas\n\n- **Horizontal bars are supported** — set `orientation: \"horizontal\"` on a `bar`\n  spec (keep `encoding.x` = category, `encoding.y` = value; the renderer swaps the\n  axes). For \"top N\" \u002F ranked breakdowns still sort rows by value\n  (`topN(rows, key, n)`); horizontal reads best when category labels are long. For\n  a category comparison of two points (e.g. before\u002Fafter), use a **`dumbbell`**.\n- **Reference lines & combo charts now exist** (0.15). Use `annotations: [{ type:\n  \"line\", value }]` for a target\u002Fthreshold line, and the `combo` type for two\n  measures on different y-scales — don't fake either with stacked `ChartCard`s.\n- **Temporal fields are ISO strings** (`\"2024-01\"`, `\"2024-01-15\"`) or epoch ms —\n  JSON has no `Date`. Mark the field `type: \"temporal\"` for a time axis.\n- **Empty `data` → empty tile.** A spec with `data: []` makes `ChartCard` show\n  its empty state. Never ship mock\u002Fplaceholder rows in the real app — the one\n  exception is the clearly-labeled bundled demo under `src\u002Fdemo\u002F**`, which you\n  delete when you wire the real model.\n\n## Cards\n\n### `ChartCard`\nThe card shell — rounded-2xl, hairline border, no shadow — in two modes:\n\n```tsx\n\u002F\u002F Spec mode (the common case): pass a Graphein spec + query state.\n\u003CChartCard title=\"Revenue\" subtitle=\"Last 12 months\"\n  loading={isLoading} error={error} spec={spec} \u002F>\n\n\u002F\u002F Children mode: own the body (e.g. a slicer, custom content).\n\u003CChartCard title=\"Filters\">\u003CListSlicer … \u002F>\u003C\u002FChartCard>\n```\n\nProps: `eyebrow`, `title`, `subtitle`, `action` (right-aligned header slot),\n`variant` (`\"surface\" | \"feature\" | \"outline\" | \"ghost\"`), `accent`\n(thin left spine; use chart tokens like `\"chart-1\"`), `spec`, `height` (omit\nfor responsive aspect-based height; table\u002Fmatrix specs auto-use a fixed scroll\nheight), `isEmpty` (force empty; defaults to detecting empty `spec.data`),\n`store`, `onSelectionChange`, `footer`, `loading`, `error`, `emptyMessage`,\n`onRetry`, `bodyClassName`, `children`.\n\n### `KpiCard`\nHero metric tile: big formatted value, colored delta pill, optional accent dot \u002F\nbadge \u002F icon, an optional `variant`, and an inline `trend` sparkline. Prefer\n`StatStrip` for the top KPI header; use `KpiCard` for standalone metrics.\n\n```tsx\n\u003CKpiCard\n  label=\"Revenue\"\n  data={rows} valueKey=\"revenue\"   \u002F\u002F …or a literal `value={341500}`\n  valueFormat=\"currency\"\n  delta={9.2}                       \u002F\u002F signed PERCENT-scale number → +9.2% pill\n  deltaLabel=\"vs last month\"\n  trend={rows.map((r) => r.revenue)} \u002F\u002F sparkline; auto-derives delta if omitted\n  invertDelta={false}               \u002F\u002F true when down-is-good (cost, churn)\n\u002F>\n```\n\nPass a literal `value` **or** `data` + `valueKey` (reads **only the first row** — feed a single-row measure result or a\nprecomputed `value`, not a multi-row table you expect it to aggregate). With no\nvalue it renders the empty state — never a fake `0`. `delta` is a **percent\nnumber** (`9.2` → `+9.2%`), not a fraction. Use `deriveKpi(result, { valueKey })`\nto get `{ value, previous, delta, trend }` from a time series in one call.\n\n> **Empty card with data present?** `valueKey` must match a mapped column name\n> **exactly** (case-sensitive). Alias columns in `toChartData({ columns: … })`\n> for stable keys; in dev the console prints the available keys.\n\n### `DataTableCard`\nA Graphein `table` \u002F `matrix` in the card shell — virtualized, sortable, themed,\nwith conditional formatting, groups, and totals. Build a table spec with\n`toTable(result, { columns })`; hand-author a `matrix` over `toChartData(result)`\nrows for a pivot\u002Fcross-tab.\n\n```tsx\nconst table = toTable(data, {\n  columns: [\n    { field: \"account\", source: \"Customer[Account]\", title: \"Account\" },\n    { field: \"revenue\", source: \"Revenue\", title: \"Revenue\", format: \"$,.0f\", align: \"right\",\n      conditionalFormat: { type: \"bar\", showValue: true } },\n  ],\n  sort: { field: \"revenue\", order: \"desc\" },\n  totals: { label: \"Total\" },\n});\n\n\u003CDataTableCard title=\"Top accounts\" loading={isLoading} error={error}\n  spec={table} height={420} \u002F>\n```\n\nProps: `spec` (`TableSpec | MatrixSpec`), `height` (default `360`), `store`,\n`onSelectionChange`, `isEmpty`, plus the shared card state props (`title`,\n`subtitle`, `action`, `loading`, `error`, `emptyMessage`, `onRetry`). See\n[formatting & color](references\u002Fformatting.md) and the\n[Graphein spec reference](references\u002Fgraphein-spec-reference.md) for table\u002Fmatrix\nfields.\n\n## Interactivity\n\nGraphein specs can publish and consume named selections:\n\n- `params` publishes a `point` or `interval` selection (click marks or brush).\n- `highlight` consumes a selection by emphasizing matches and dimming the rest.\n- `filter` consumes selections or literal predicates by subsetting rows.\n\n```jsonc\n\u002F\u002F Bar publishes a region pick; line consumes it as a highlight.\n{ \"type\":\"bar\", \"data\":rows,\n  \"params\":[{ \"name\":\"pick\", \"select\":{ \"type\":\"point\", \"fields\":[\"region\"] } }],\n  \"encoding\":{ \"x\":{\"field\":\"region\"}, \"y\":{\"field\":\"revenue\"} } }\n{ \"type\":\"line\", \"data\":rows, \"highlight\":{ \"param\":\"pick\" },\n  \"encoding\":{ \"x\":{\"field\":\"month\",\"type\":\"temporal\"}, \"y\":{\"field\":\"revenue\"}, \"series\":{\"field\":\"region\"} } }\n```\n\nUse `SelectionStoreProvider` \u002F `useSelectionStore()` and pass the same `store` to\nseveral `ChartCard`s or `DataTableCard`s for cross-highlight\u002Fcross-filter. The\n**default is Power BI–style**: `useCrossHighlight(field)` + spreading\n`crossHighlightParams(param, fields)` into the source spec makes a click dim that\nchart's own unpicked marks while every other tile re-queries — feed the source\n`applyFilters(rows, pick.own(selections))` and others `toDaxFilters(selections)`.\nFor a manual bridge, call `useSelectionFilterBridge(store, { fieldMap })`: it maps\nGraphein selections into `useFilterState`, which drives `applyFilters` and\n`toDaxFilters`. React slicers + DAX re-query remain the primary filter path because\nthis app's tiles are independently DAX-aggregated per tile.\n\n## Shape helpers (DAX → rows\u002Fspecs)\n\n- **`toChartData(result, { columns? })`** → tidy rows for a spec's `data`. Alias\n  columns for stable keys.\n- **`toTable(result, { columns, sort, totals, density, striped, numeric, text })`**\n  → a Graphein `table` spec for `DataTableCard`. `columns` are Graphein table\n  columns plus optional `source` (full `Table[Col]`, short name, or index).\n- **`topN(rows, valueKey, n, { other?, ascending? })`** — sort + slice mapped\n  rows for ranked bars \u002F leaderboards, with an optional `\"Other\"` rollup.\n- **`deriveKpi(result, { valueKey })`** → `{ value, previous, delta, trend }` for\n  a `KpiCard`.\n\n## Layout\n\nDefault to the new flat, non-uniform dashboard path: `PageShell` → `StatStrip` →\n`DashboardGrid` + `Tile`. Build hierarchy with layout, surfaces, borders, accent\nedges, and typography — **no gradients or shadows**.\n\n```tsx\nimport {\n  PageShell, ThemeToggle,\n  StatStrip, Stat,\n  DashboardGrid, Tile,\n  ChartCard, DataTableCard,\n} from \"@\u002Fcomponents\u002Fdashboard\";\n\n\u003CPageShell eyebrow=\"Sales\" title=\"Revenue overview\" subtitle=\"FY24\" actions={\u003CThemeToggle \u002F>}>\n  \u003CStatStrip>\n    \u003CStat label=\"Revenue\" data={rows} valueKey=\"revenue\" valueFormat=\"currency\" accent=\"chart-1\" delta={12.4} \u002F>\n    \u003CStat label=\"Orders\" data={rows} valueKey=\"orders\" delta={3.1} \u002F>\n    \u003CStat label=\"Avg order\" value={84.2} valueFormat=\"currency\" delta={-1.2} \u002F>\n  \u003C\u002FStatStrip>\n\n  \u003CDashboardGrid>\n    \u003CTile size=\"hero\">\u003CChartCard title=\"Revenue trend\" className=\"h-full\" variant=\"feature\" accent=\"chart-1\" spec={lineSpec} \u002F>\u003C\u002FTile>\n    \u003CTile size=\"md\">\u003CChartCard title=\"By region\" spec={barSpec} \u002F>\u003C\u002FTile>\n    \u003CTile size=\"md\">\u003CChartCard title=\"Channel mix\" spec={pieSpec} \u002F>\u003C\u002FTile>\n    \u003CTile size=\"full\">\u003CDataTableCard title=\"Detail\" spec={tableSpec} \u002F>\u003C\u002FTile>\n  \u003C\u002FDashboardGrid>\n\u003C\u002FPageShell>\n```\n\n- **Frames:** `PageShell` is the default; `SidebarShell` adds an in-content\n  filter\u002Fcontext `rail` for filter-heavy analytics; `AppShell` is the flexible\n  lower-level frame for custom mastheads, `toolbar`, or `rail` composition.\n- **Metric header:** `StatStrip` + `Stat` is one bordered, hairline-divided band\n  of 2–5 metrics. Prefer it over four look-alike `KpiCard`s at the top.\n- **Grid:** `DashboardGrid` is the responsive 12-col canvas. Use `Tile size`:\n  `\"sm\"` 3, `\"md\"` 4, `\"lg\"` 6, `\"wide\"` 8, `\"hero\"` 8×2, `\"full\"` 12.\n  Mix sizes for editorial rhythm; do **not** default to a uniform grid. A `hero`\n  tile needs `className=\"h-full\"` on the card inside (it spans 2 rows; without it\n  the card sits at its natural height and leaves the lower row blank). Two `md`\n  tiles right after a `hero` stack to fill its remaining 4-col × 2-row corner.\n- **Zones\u002Fcards:** `SectionBand` creates alternate-surface (`surface-2`) zones.\n  `Card`, `ChartCard`, and `KpiCard` use flat variants (`\"surface\" | \"feature\" |\n  \"outline\" | \"ghost\"`); `Card`\u002F`ChartCard` also take `accent` for a thin left\n  spine. Use chart tokens such as `\"chart-1\"`, not raw colors.\n- **Legacy:** `KpiGrid`, `ChartGrid`, `BentoGrid`, and `BentoItem` still exist for\n  back-compat, but avoid them by default in new dashboards.\n\n## Controls & slicers (interactivity)\n\nChart specs can now publish selections, but React slicers remain the primary\nserver-side filter path in this app: they update shared filter state, which then\nre-filters client rows or re-queries DAX.\n\n**Lightweight controls** — own the value in `useState`, filter your rows:\n\n```tsx\nconst [range, setRange] = useState(\"30d\");\n\u003CSegmentedControl value={range} onChange={setRange}\n  options={[{ label: \"7D\", value: \"7d\" }, { label: \"30D\", value: \"30d\" }]} \u002F>\n```\n\n`SegmentedControl\u003CT>` (single-select pills) · `FilterChips\u003CT>` (multi-select chips).\n\n**Power BI-style slicers** — wire one **shared filter model**. **The starter\nalready mounts a `FilterBar` of slicers in the `PageShell` toolbar, wrapped in\n`\u003CFilterStateProvider>`** — feed real options and apply the selections; you\nrarely need to add the provider yourself. Every slicer reads\u002Fwrites the same\nselections. **Apply** them with `applyFilters(rows, selections)` (instant,\nclient-side) or `toDaxFilters(selections)` (re-query the model — see `dax`).\n\n```tsx\n\u003CFilterStateProvider>\n  \u003CFilterBar>\n    \u003CDropdownSlicer label=\"Category\" field=\"Product[Category]\" options={catOptions} \u002F>\n    \u003CDateRangeSlicer label=\"Date\" field=\"Date[Date]\" \u002F>\n    \u003CRangeSlicer label=\"Price\" field=\"Product[Price]\" min={0} max={1000} \u002F>\n  \u003C\u002FFilterBar>\n  \u003CRevenueByRegion \u002F>   {\u002F* reads useFilterState() → applyFilters(rows, selections) *\u002F}\n\u003C\u002FFilterStateProvider>\n```\n\nSlicers: `DropdownSlicer`, `ListSlicer`, `SearchSlicer`, `DateRangeSlicer`,\n`RangeSlicer`, `FilterBar`. Fetch distinct values with\n`useSlicerOptions({ connection, field, … })`. Full guide:\n[slicers & filter state](references\u002Fslicers.md).\n\n## Formatting & color\n\n- **In a spec:** format numbers\u002Fdates with Graphein's\n  [format mini-language](references\u002Fformatting.md) on a `FieldDef` —\n  `\"$,.0f\"`, `\",d\"`, `\".1%\"`, `\".2s\"` (→ `1.2k`), `\"%b %e, %Y\"` (dates).\n- **Pie labels:** use `labels` (`placement: \"outside\"` for callouts,\n  `content: \"category-percent\"`, etc.).\n- **KpiCard:** `valueFormat` — `\"number\" | \"compact\" | \"currency\" | \"percent\"\n  (0–100) | \"ratio\" (0–1)` or a `(n) => string` function.\n- **Table\u002Fmatrix:** column\u002Fvalue `format` plus `conditionalFormat` (`bar`, `icon`,\n  `colorScale`, `rules`).\n- **Color\u002Ftheme:** never put hex in a spec — `ChartCard` themes every chart from\n  `src\u002Fglobal.css` tokens (`--color-chart-1..10`, accent, dark mode). Restyle by\n  editing those tokens. See [formatting & color](references\u002Fformatting.md).\n\n## State tiles\n\nUsed internally by the cards; use directly only for custom content.\n\n- **`EmptyTile`** (`message`, `icon`, `height`) · **`ErrorTile`** (`error`,\n  `title`, `onRetry`, `height`) · **`ChartSkeleton`** \u002F **`KpiSkeleton`** ·\n  **`TileBody`** (error → loading → empty → children switchboard).\n\n## Import surface\n\n```tsx\nimport {\n  \u002F\u002F layout + controls\n  AppShell, PageShell, SidebarShell, DashboardGrid, Tile, StatStrip, Stat,\n  SectionBand, Section, Card, ThemeToggle, SegmentedControl, FilterChips,\n  \u002F\u002F legacy layout (back-compat; avoid by default)\n  KpiGrid, ChartGrid, BentoGrid, BentoItem,\n  \u002F\u002F slicers + shared filter state\n  FilterStateProvider, useFilterState, FilterBar,\n  DropdownSlicer, ListSlicer, SearchSlicer, DateRangeSlicer, RangeSlicer,\n  useSlicerOptions, applyFilters, toDaxFilters,\n  \u002F\u002F cards + Graphein runtime\n  ChartCard, KpiCard, DataTableCard, Chart, validateSpec, createSelectionStore,\n  SelectionStoreProvider, useSelectionStore, useSelection, type ChartSpec,\n  \u002F\u002F selection bridge\n  useSelectionFilterBridge, selectionToFilters, filterToSelection,\n  useCrossHighlight, crossHighlightParams, selectionsExcept,\n  \u002F\u002F state tiles + sparkline\n  EmptyTile, ErrorTile, ChartSkeleton, KpiSkeleton, TileBody, Sparkline,\n  \u002F\u002F DAX → rows\u002Fspec helpers + formatting\u002Fcolor\n  toChartData, toTable, topN, deriveKpi, pivotChartData,\n  formatNumber, formatCompact, formatCurrency, formatPercent, formatDate,\n  seriesColor, roleColor,\n} from \"@\u002Fcomponents\u002Fdashboard\";\n```\n\n## References\n\n- [Graphein spec reference](references\u002Fgraphein-spec-reference.md) — every chart\u002Ftable\n  type, channel, and option, with copy-paste JSON.\n- [Formatting & color](references\u002Fformatting.md) — the format mini-language,\n  `valueFormat`, table\u002Fmatrix formats, conditional formatting, theme tokens.\n- [Slicers & filter state](references\u002Fslicers.md) · [interactions](references\u002Finteractions.md).\n- [Multiple data inputs](references\u002Fmulti-data-input.md) ·\n  [choosing the closest type](references\u002Fcustom-charts.md).\n",{"name":5,"description":7},"main","6007598ad84bc06f9d584f0d2ba6af970422a9fe","templates\u002Funiversal-app\u002F.agents\u002Fskills\u002Fvisuals",70,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-14 07:42:02",{"source":9,"skillName":5,"commands":70,"prompt":80,"zipAvailable":81},[71,74,77],{"tool":72,"command":73},"npx","npx skills add microsoft\u002Fawesome-rayfin --skill visuals",{"tool":75,"command":76},"bunx","bunx skills add microsoft\u002Fawesome-rayfin --skill visuals",{"tool":78,"command":79},"pnpm","pnpm dlx skills add microsoft\u002Fawesome-rayfin --skill visuals","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Funiversal-app\u002F.agents\u002Fskills\u002Fvisuals\u002FSKILL.md",true,[83,89,93,97,101,105],{"path":84,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fcustom-charts.md","REFERENCE","参考文档",2966,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Funiversal-app\u002F.agents\u002Fskills\u002Fvisuals\u002Freferences\u002Fcustom-charts.md",{"path":90,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Fformatting.md",6515,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Funiversal-app\u002F.agents\u002Fskills\u002Fvisuals\u002Freferences\u002Fformatting.md",{"path":94,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":95,"sourceHtmlUrl":96},"references\u002Fgraphein-spec-reference.md",14985,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Funiversal-app\u002F.agents\u002Fskills\u002Fvisuals\u002Freferences\u002Fgraphein-spec-reference.md",{"path":98,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":99,"sourceHtmlUrl":100},"references\u002Finteractions.md",5786,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Funiversal-app\u002F.agents\u002Fskills\u002Fvisuals\u002Freferences\u002Finteractions.md",{"path":102,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":103,"sourceHtmlUrl":104},"references\u002Fmulti-data-input.md",4758,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Funiversal-app\u002F.agents\u002Fskills\u002Fvisuals\u002Freferences\u002Fmulti-data-input.md",{"path":106,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":107,"sourceHtmlUrl":108},"references\u002Fslicers.md",6104,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Funiversal-app\u002F.agents\u002Fskills\u002Fvisuals\u002Freferences\u002Fslicers.md",[110,132,156,180,202,224],{"skillNo":111,"name":5,"nameZh":17,"description":112,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":55},"01M70HMXK23DA6CE0T9R4DNDA9","Use when user wants to incorporate charts, graphs, data grid,  or other visual representations of data into their project. Use VegaVisual and DataGrid components to create these visuals,  utilizing the shared DataTable input, formatting, theme, and interactivity. Covers the onInteraction selection\u002Fclick events host apps consume, named multi-table data input for layered overlays and reference lines, and Vega-Lite native selections.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Fcaldova-reorder\u002F.agents\u002Fskills\u002Fvisuals\u002FSKILL.md",[],[5,43,116,117,48,118,119,120,121,122,123,124,32,125,126,127,128,129,130,131],"click","theme","for","overlays","project","selection","host","use","apps","visual","components","grid","multi","create","layered","native",{"skillNo":133,"name":134,"nameZh":17,"description":135,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":136,"categories":137,"keywords":138,"publishedAt":55},"01M70HMVE4BANY7VVP0JR2GQ92","schema-discovery","Explore Power BI semantic model schemas using DAX INFO functions. Progressive metadata discovery strategy, scope estimation, and narrowing techniques for tables, columns, measures, and relationships.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Fcaldova-reorder\u002F.agents\u002Fskills\u002Fschema-discovery\u002FSKILL.md",[],[139,140,141,142,143,46,118,144,145,146,147,148,149,150,151,152,153,52,154,155],"discovery","schema discovery","schema","power","scope","explore","techniques","strategy","estimation","power bi","functions","info","bi","relationships","columns","tables","semantic",{"skillNo":157,"name":158,"nameZh":17,"description":159,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":160,"categories":161,"keywords":162,"publishedAt":55},"01M70HMQD0PKCKWCY2NQ8VCCYH","rayfin","Use when doing ANY task involving Rayfin — scaffolding, data models, decorators, auth, deployment, CLI commands, or client setup. Triggers: rayfin, rayfin init, rayfin up, rayfin login, RayfinClient, @entity, @role, @anonymous, @authenticated, @text, @uuid, @int, @decimal, @boolean, @date, @email, @set, @one, @many, DAB, Data API Builder, rayfin.yml, publishableKey, signUp, signIn, signOut, sendMagicLink, handleMagicLinkCallback, ensureSignedInWithFabric, Fabric SSO, Entra ID, rayfin up db apply, rayfin up staticapp deploy, schema.ts, OpaqueSession, onSessionChange, GraphQL select, GraphQL create, GraphQL update, GraphQL delete, findById, executePaginated, RLS policy, row-level security, claims.sub, claims.email, TC39 decorators, config generation, dialect, mssql, postgresql","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Fcaldova-reorder\u002F.agents\u002Fskills\u002Frayfin\u002FSKILL.md",[],[158,163,164,165,166,167,168,169,170,171,172,173,174,32,175,176,177,178,179,129],"builder","SET","decorators","anonymous","auth","db","scaffolding","select","up","init","entra id","api builder","rls","api","text","mssql","postgresql",{"skillNo":181,"name":182,"nameZh":17,"description":183,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":55},"01M70HMFPA9WXWY5X7C14XB11D","rayfin-connectors","Use for Rayfin connectors that wire existing Fabric SQL data sources (Lakehouse, Warehouse, SQL Database) into an app as GraphQL-backed entities. Triggers: rayfin connector, rayfin up connector apply, connectors:, fabric-sqlanalytics, fabric-warehouse, fabric-sqldatabase, kusto, kql, eventhouse, workspaceId, itemId, operations:, AppConnectorsSchema, ConnectorsSchema, rayfin\u002Fconnectors\u002F, metadata.json, connector @role policy, connector claims.sub filter, connector claims.email filter, ConnectorsRayfinClient, rayfin-client.ts, client.connectors, connectorConfig, GraphQLBackedConnector, RestrictedDataApi, schema.ts aggregate, generate entities from metadata, add a use case on specific entities, wire connector into client, call a connector from the SDK, rayfin connector inspect, inspect connector data, sample connector rows, fabric-semanticmodel, --entity, --query, DAX EVALUATE, read-only sample query, rayfin connector search, discover connectable sources, find fabric sources to add, --all-workspaces, --workspace-id, connector search interactive picker, rayfin connector invoke, invoke a connector operation, run executeQuery, --input, --file, RAYFIN_FEATURE_FLAGS, resultSetRowCountLimit, limit rows, row limit, cap rows, too many rows, overflow","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Fcaldova-reorder\u002F.agents\u002Fskills\u002Frayfin-connectors\u002FSKILL.md",[],[187,158,188,42,189,190,49,191,38,192,193,194,195,196,197,198,199,200,201,118],"rayfin connectors","connectors","inspect","workspaces","invoke","cap","generate","data sources","run","read","input","as","kql","limit","email",{"skillNo":203,"name":204,"nameZh":17,"description":205,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":206,"categories":207,"keywords":208,"publishedAt":55},"01M70HMD71TMHM9NEZV0870V9B","query-design","Separates DAX data-fetching from TypeScript presentation. Guides when to use  DAX vs. TypeScript vs. Vega-Lite for aggregation, total rows, FORMAT(), SELECTCOLUMNS,  BLANK handling, filtering, multi-grain queries, cross-filtering and cross-highlight subset\u002Foverlay queries, and format strings.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Fcaldova-reorder\u002F.agents\u002Fskills\u002Fquery-design\u002FSKILL.md",[],[209,210,211,212,118,213,214,123,32,215,128,216,217,218,219,220,221,222,223,52],"query design","design","query","overlay","strings","filtering","guides","queries","grain","aggregation","format","typescript","data-fetching","data","when to use",{"skillNo":225,"name":226,"nameZh":17,"description":227,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":228,"categories":229,"keywords":230,"publishedAt":55},"01M70HMAX3MRJWF62P8PAYF1R3","playwright-cli","Automate browser interactions, test web pages and work with Playwright tests.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fawesome-rayfin\u002Fblob\u002Fmain\u002Ftemplates\u002Fcaldova-reorder\u002F.agents\u002Fskills\u002Fplaywright-cli\u002FSKILL.md",[],[231,232,233,226,234,235,72,236,237,238,239,240,241,242,243,244],"playwright cli","playwright","cli","pages","tests","Bash","browser","with","test","work","web","test web","npm","automate"]