@dxvis/flatbi 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +21 -0
- package/.claude-plugin/plugin.json +13 -0
- package/LICENSE +21 -0
- package/README.md +96 -2
- package/dist/cli/bin.mjs +7553 -0
- package/dist/runtime/index.html +43 -0
- package/docs/recipes.md +213 -0
- package/docs/spec-reference.md +640 -0
- package/docs/tile-guide.md +25 -0
- package/llms.txt +55 -0
- package/package.json +66 -4
- package/schema/dash.schema.json +1784 -0
- package/skills/flatbi/SKILL.md +40 -0
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
# Spec reference
|
|
2
|
+
|
|
3
|
+
<!-- Generated from src/spec/schema.ts by `npm run generate`. Do not edit by hand. -->
|
|
4
|
+
|
|
5
|
+
A flatbi dashboard spec. Every key below is checked by `flatbi check`; a key that is not listed is an error.
|
|
6
|
+
|
|
7
|
+
IDs, the keys of `sources`, `models`, `measures` and `tiles`, start with a letter or underscore and contain only letters, digits and underscores.
|
|
8
|
+
|
|
9
|
+
## Top level
|
|
10
|
+
|
|
11
|
+
| Key | Type | Required | Description |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| `dash` | `1` | yes | The spec version: always 1. |
|
|
14
|
+
| `title` | string | yes | The dashboard's title. |
|
|
15
|
+
| `description` | string | no | A line shown under the title. |
|
|
16
|
+
| `locale` | string | no | BCP 47 locale tag for number and date formatting, such as `en-US` or `de-DE`. Defaults to `en-US`. |
|
|
17
|
+
| `currency` | string | no | ISO 4217 currency code used by `format: currency`, such as `USD` or `EUR`. Defaults to `USD`. |
|
|
18
|
+
| `sources` | mapping of IDs (see below) | yes | Input datasets, by source ID. |
|
|
19
|
+
| `models` | mapping of IDs (see below) | yes | Models, by model ID. With more than one, each tile names its own with `model`. |
|
|
20
|
+
| `filters` | list of items of several kinds (see below) | no | Global filter controls shown above the tiles. |
|
|
21
|
+
| `tiles` | mapping of IDs (see below) | yes | Tiles, by tile ID. |
|
|
22
|
+
| `layout` | list of lists of strings | yes | Rows of tiles on a 12-column grid. Place every tile exactly once. Each item: One row of tiles. Tiles without a span share the remaining width. Each item: A tile ID, with an optional `:span` from 1 to 12. |
|
|
23
|
+
| `theme` | mapping (see below) | no | Visual theme options: colour mode, accent colour and spacing density. |
|
|
24
|
+
|
|
25
|
+
### `sources.<id>`
|
|
26
|
+
|
|
27
|
+
A named input dataset.
|
|
28
|
+
|
|
29
|
+
One of: `file`, `sql`.
|
|
30
|
+
|
|
31
|
+
#### `sources.<id>` with `file`
|
|
32
|
+
|
|
33
|
+
A file or database source.
|
|
34
|
+
|
|
35
|
+
| Key | Type | Required | Description |
|
|
36
|
+
|---|---|---|---|
|
|
37
|
+
| `file` | string | yes | Path to a CSV, Parquet, JSON, NDJSON, XLSX, DuckDB or SQLite file, relative to the spec file. |
|
|
38
|
+
| `table` | string | no | Table name inside a DuckDB or SQLite database file. |
|
|
39
|
+
| `query` | string | no | SQL query to run against a DuckDB or SQLite database file. |
|
|
40
|
+
| `sheet` | string | no | Worksheet name inside an XLSX workbook. Defaults to the first sheet. |
|
|
41
|
+
|
|
42
|
+
#### `sources.<id>` with `sql`
|
|
43
|
+
|
|
44
|
+
A source derived by querying other sources.
|
|
45
|
+
|
|
46
|
+
| Key | Type | Required | Description |
|
|
47
|
+
|---|---|---|---|
|
|
48
|
+
| `sql` | string | yes | DuckDB SQL query over other sources in this spec, for joins and cleaning. |
|
|
49
|
+
|
|
50
|
+
### `models.<id>`
|
|
51
|
+
|
|
52
|
+
A named, flat table built from one source.
|
|
53
|
+
|
|
54
|
+
| Key | Type | Required | Description |
|
|
55
|
+
|---|---|---|---|
|
|
56
|
+
| `source` | string | yes | The source the model reads. |
|
|
57
|
+
| `time` | string | no | The model's main date dimension, enabling time grains, date-range filters and KPI comparisons. |
|
|
58
|
+
| `dimensions` | list of items of several kinds (see below) | no | Dimensions of the model that tiles and filters may group or filter by. |
|
|
59
|
+
| `measures` | mapping of IDs (see below) | no | The model's measures, by measure ID. |
|
|
60
|
+
|
|
61
|
+
#### `models.<id>.dimensions[]`
|
|
62
|
+
|
|
63
|
+
A column name, or a mapping with `name`, optional `sql` and optional `order`.
|
|
64
|
+
|
|
65
|
+
One of: `string`, `name`.
|
|
66
|
+
|
|
67
|
+
##### `models.<id>.dimensions[]` with `string`
|
|
68
|
+
|
|
69
|
+
A column of the source.
|
|
70
|
+
|
|
71
|
+
##### `models.<id>.dimensions[]` with `name`
|
|
72
|
+
|
|
73
|
+
A computed or ordered dimension.
|
|
74
|
+
|
|
75
|
+
| Key | Type | Required | Description |
|
|
76
|
+
|---|---|---|---|
|
|
77
|
+
| `name` | string | yes | The dimension's name, used by tiles and filters. |
|
|
78
|
+
| `sql` | string | no | Row-level DuckDB expression that computes the dimension, such as a `CASE` expression. |
|
|
79
|
+
| `order` | list of strings or numbers | no | Fixed display order for the dimension's categories, such as `[S, M, L]`. Each item: A category value in its fixed display order. |
|
|
80
|
+
|
|
81
|
+
#### `models.<id>.measures.<id>`
|
|
82
|
+
|
|
83
|
+
A named aggregate, defined once and shown by any tile.
|
|
84
|
+
|
|
85
|
+
One of: `agg: sum`, `agg: count`, `agg: count_distinct`, `agg: min`, `agg: max`, `agg: avg`, `formula`.
|
|
86
|
+
|
|
87
|
+
##### `models.<id>.measures.<id>` with `agg: sum`
|
|
88
|
+
|
|
89
|
+
The total of an expression over the rows.
|
|
90
|
+
|
|
91
|
+
| Key | Type | Required | Description |
|
|
92
|
+
|---|---|---|---|
|
|
93
|
+
| `agg` | `sum` | yes | The aggregation, which selects this kind of measure. |
|
|
94
|
+
| `sql` | string | yes | Row-level DuckDB expression to add up, such as a column. |
|
|
95
|
+
| `where` | string | no | Row-level DuckDB predicate, such as `status = 'paid'`. Only rows where it is true count toward the measure. |
|
|
96
|
+
| `format` | `integer` or `number` or `percent` or `currency` or `compact` | no | How the measure's numbers display: `integer`, `number`, `percent`, `currency` or `compact`. |
|
|
97
|
+
| `decimals` | number | no | Number of decimal places to show (0 to 20). |
|
|
98
|
+
|
|
99
|
+
##### `models.<id>.measures.<id>` with `agg: count`
|
|
100
|
+
|
|
101
|
+
The number of rows.
|
|
102
|
+
|
|
103
|
+
| Key | Type | Required | Description |
|
|
104
|
+
|---|---|---|---|
|
|
105
|
+
| `agg` | `count` | yes | The aggregation, which selects this kind of measure. |
|
|
106
|
+
| `sql` | string | no | Row-level DuckDB expression. When set, only rows where it is not null count. |
|
|
107
|
+
| `where` | string | no | Row-level DuckDB predicate, such as `status = 'paid'`. Only rows where it is true count toward the measure. |
|
|
108
|
+
| `format` | `integer` or `number` or `percent` or `currency` or `compact` | no | How the measure's numbers display: `integer`, `number`, `percent`, `currency` or `compact`. |
|
|
109
|
+
| `decimals` | number | no | Number of decimal places to show (0 to 20). |
|
|
110
|
+
|
|
111
|
+
##### `models.<id>.measures.<id>` with `agg: count_distinct`
|
|
112
|
+
|
|
113
|
+
The number of distinct values of an expression, not counting missing ones.
|
|
114
|
+
|
|
115
|
+
| Key | Type | Required | Description |
|
|
116
|
+
|---|---|---|---|
|
|
117
|
+
| `agg` | `count_distinct` | yes | The aggregation, which selects this kind of measure. |
|
|
118
|
+
| `sql` | string | yes | Row-level DuckDB expression whose distinct values are counted, such as an ID. |
|
|
119
|
+
| `where` | string | no | Row-level DuckDB predicate, such as `status = 'paid'`. Only rows where it is true count toward the measure. |
|
|
120
|
+
| `format` | `integer` or `number` or `percent` or `currency` or `compact` | no | How the measure's numbers display: `integer`, `number`, `percent`, `currency` or `compact`. |
|
|
121
|
+
| `decimals` | number | no | Number of decimal places to show (0 to 20). |
|
|
122
|
+
|
|
123
|
+
##### `models.<id>.measures.<id>` with `agg: min`
|
|
124
|
+
|
|
125
|
+
The smallest value of an expression over the rows.
|
|
126
|
+
|
|
127
|
+
| Key | Type | Required | Description |
|
|
128
|
+
|---|---|---|---|
|
|
129
|
+
| `agg` | `min` | yes | The aggregation, which selects this kind of measure. |
|
|
130
|
+
| `sql` | string | yes | Row-level DuckDB expression, such as a column. |
|
|
131
|
+
| `where` | string | no | Row-level DuckDB predicate, such as `status = 'paid'`. Only rows where it is true count toward the measure. |
|
|
132
|
+
| `format` | `integer` or `number` or `percent` or `currency` or `compact` | no | How the measure's numbers display: `integer`, `number`, `percent`, `currency` or `compact`. |
|
|
133
|
+
| `decimals` | number | no | Number of decimal places to show (0 to 20). |
|
|
134
|
+
|
|
135
|
+
##### `models.<id>.measures.<id>` with `agg: max`
|
|
136
|
+
|
|
137
|
+
The largest value of an expression over the rows.
|
|
138
|
+
|
|
139
|
+
| Key | Type | Required | Description |
|
|
140
|
+
|---|---|---|---|
|
|
141
|
+
| `agg` | `max` | yes | The aggregation, which selects this kind of measure. |
|
|
142
|
+
| `sql` | string | yes | Row-level DuckDB expression, such as a column. |
|
|
143
|
+
| `where` | string | no | Row-level DuckDB predicate, such as `status = 'paid'`. Only rows where it is true count toward the measure. |
|
|
144
|
+
| `format` | `integer` or `number` or `percent` or `currency` or `compact` | no | How the measure's numbers display: `integer`, `number`, `percent`, `currency` or `compact`. |
|
|
145
|
+
| `decimals` | number | no | Number of decimal places to show (0 to 20). |
|
|
146
|
+
|
|
147
|
+
##### `models.<id>.measures.<id>` with `agg: avg`
|
|
148
|
+
|
|
149
|
+
The average of an expression over the rows where it has a value.
|
|
150
|
+
|
|
151
|
+
| Key | Type | Required | Description |
|
|
152
|
+
|---|---|---|---|
|
|
153
|
+
| `agg` | `avg` | yes | The aggregation, which selects this kind of measure. |
|
|
154
|
+
| `sql` | string | yes | Row-level DuckDB expression to average, such as a column. |
|
|
155
|
+
| `where` | string | no | Row-level DuckDB predicate, such as `status = 'paid'`. Only rows where it is true count toward the measure. |
|
|
156
|
+
| `format` | `integer` or `number` or `percent` or `currency` or `compact` | no | How the measure's numbers display: `integer`, `number`, `percent`, `currency` or `compact`. |
|
|
157
|
+
| `decimals` | number | no | Number of decimal places to show (0 to 20). |
|
|
158
|
+
|
|
159
|
+
##### `models.<id>.measures.<id>` with `formula`
|
|
160
|
+
|
|
161
|
+
A ratio or other arithmetic over measures, computed after they aggregate, so it stays right under any filter. Division by zero gives no value.
|
|
162
|
+
|
|
163
|
+
| Key | Type | Required | Description |
|
|
164
|
+
|---|---|---|---|
|
|
165
|
+
| `formula` | string | yes | Arithmetic over other measures of the model: `+ - * /`, parentheses and numbers, such as `revenue / orders`. |
|
|
166
|
+
| `format` | `integer` or `number` or `percent` or `currency` or `compact` | no | How the measure's numbers display: `integer`, `number`, `percent`, `currency` or `compact`. |
|
|
167
|
+
| `decimals` | number | no | Number of decimal places to show (0 to 20). |
|
|
168
|
+
|
|
169
|
+
### `filters[]`
|
|
170
|
+
|
|
171
|
+
A global filter control bound to a dimension by name.
|
|
172
|
+
|
|
173
|
+
One of: `type: select`, `type: multi_select`, `type: date_range`.
|
|
174
|
+
|
|
175
|
+
#### `filters[]` with `type: select`
|
|
176
|
+
|
|
177
|
+
A single-select filter.
|
|
178
|
+
|
|
179
|
+
| Key | Type | Required | Description |
|
|
180
|
+
|---|---|---|---|
|
|
181
|
+
| `type` | `select` | yes | Picks a single value of the dimension, or all values. |
|
|
182
|
+
| `field` | string | yes | The dimension to filter by across every model that defines it. |
|
|
183
|
+
| `id` | string | no | Filter ID used in the URL hash. Defaults to `field`. |
|
|
184
|
+
| `default` | string or number | no | Initial value selected when opening the dashboard. |
|
|
185
|
+
|
|
186
|
+
#### `filters[]` with `type: multi_select`
|
|
187
|
+
|
|
188
|
+
A multi-select filter.
|
|
189
|
+
|
|
190
|
+
| Key | Type | Required | Description |
|
|
191
|
+
|---|---|---|---|
|
|
192
|
+
| `type` | `multi_select` | yes | Picks one or more values of the dimension. |
|
|
193
|
+
| `field` | string | yes | The dimension to filter by across every model that defines it. |
|
|
194
|
+
| `id` | string | no | Filter ID used in the URL hash. Defaults to `field`. |
|
|
195
|
+
| `default` | list of strings or numbers | no | Initial values selected when opening the dashboard. Each item: A category value. |
|
|
196
|
+
|
|
197
|
+
#### `filters[]` with `type: date_range`
|
|
198
|
+
|
|
199
|
+
A date-range filter anchored to the snapshot's as-of date.
|
|
200
|
+
|
|
201
|
+
| Key | Type | Required | Description |
|
|
202
|
+
|---|---|---|---|
|
|
203
|
+
| `type` | `date_range` | yes | Filters a date dimension by a preset anchored to the as-of date, or a custom range. |
|
|
204
|
+
| `field` | string | yes | The date dimension to filter by across every model that defines it. |
|
|
205
|
+
| `id` | string | no | Filter ID used in the URL hash. Defaults to `field`. |
|
|
206
|
+
| `default` | one of several kinds (see below) | no | Initial preset or custom `{ from, to }` range selected when opening the dashboard. |
|
|
207
|
+
|
|
208
|
+
##### `filters[].default`
|
|
209
|
+
|
|
210
|
+
Initial preset or custom `{ from, to }` range selected when opening the dashboard.
|
|
211
|
+
|
|
212
|
+
One of: ``last_7_days` or `last_30_days` or `last_90_days` or `last_12_months` or `this_month` or `this_quarter` or `this_year` or `ytd` or `all``, `option 2`.
|
|
213
|
+
|
|
214
|
+
###### `filters[].default` with ``last_7_days` or `last_30_days` or `last_90_days` or `last_12_months` or `this_month` or `this_quarter` or `this_year` or `ytd` or `all``
|
|
215
|
+
|
|
216
|
+
A relative preset anchored to the snapshot's as-of date.
|
|
217
|
+
|
|
218
|
+
###### `filters[].default` with `option 2`
|
|
219
|
+
|
|
220
|
+
A custom inclusive UTC date range with `from` and/or `to` bounds.
|
|
221
|
+
|
|
222
|
+
| Key | Type | Required | Description |
|
|
223
|
+
|---|---|---|---|
|
|
224
|
+
| `from` | string | no | Inclusive start date in `YYYY-MM-DD` format (UTC). |
|
|
225
|
+
| `to` | string | no | Inclusive end date in `YYYY-MM-DD` format (UTC). |
|
|
226
|
+
|
|
227
|
+
### `tiles.<id>`
|
|
228
|
+
|
|
229
|
+
One visual unit of the dashboard.
|
|
230
|
+
|
|
231
|
+
One of: `type: kpi`, `type: line`, `type: area`, `type: bar`, `type: combo`, `type: scatter`, `type: donut`, `type: heatmap`, `type: table`, `type: text`.
|
|
232
|
+
|
|
233
|
+
#### `tiles.<id>` with `type: kpi`
|
|
234
|
+
|
|
235
|
+
A KPI tile.
|
|
236
|
+
|
|
237
|
+
| Key | Type | Required | Description |
|
|
238
|
+
|---|---|---|---|
|
|
239
|
+
| `type` | `kpi` | yes | Shows one measure as a headline number. |
|
|
240
|
+
| `model` | string | no | The model whose dimensions and measures the tile shows. Required when the dashboard has more than one model. |
|
|
241
|
+
| `value` | string | yes | The measure to show. |
|
|
242
|
+
| `title` | string | no | The tile's heading. Generated from the measure when omitted. |
|
|
243
|
+
| `compare` | `previous_period` or `previous_year` | no | Compare against `previous_period` or `previous_year` when a bounded date filter is active. |
|
|
244
|
+
| `target` | string | no | Compare the headline measure against another measure as a target. |
|
|
245
|
+
| `good` | `up` or `down` | no | Whether higher (`up`, default) or lower (`down`) values are favourable. |
|
|
246
|
+
| `spark` | boolean | no | Set `true` to show a compact trend sparkline under the value. |
|
|
247
|
+
| `where` | mapping of IDs (see below) | no | Per-tile equality filter mapping dimension names to exact value(s). |
|
|
248
|
+
| `size` | `s` or `m` or `l` | no | Tile height override: `s` (compact), `m` (standard), or `l` (tall). |
|
|
249
|
+
| `crossfilter` | boolean | no | Set to `false` to opt this tile out of emitting and receiving cross-filter selections. |
|
|
250
|
+
|
|
251
|
+
##### `tiles.<id>.where.<id>`
|
|
252
|
+
|
|
253
|
+
Exact value or list of allowed values.
|
|
254
|
+
|
|
255
|
+
One of: `option 1`, `list of strings or numbers`.
|
|
256
|
+
|
|
257
|
+
###### `tiles.<id>.where.<id>` with `option 1`
|
|
258
|
+
|
|
259
|
+
A category value.
|
|
260
|
+
|
|
261
|
+
One of: `string`, `number`.
|
|
262
|
+
|
|
263
|
+
###### `tiles.<id>.where.<id>` with `string`
|
|
264
|
+
|
|
265
|
+
A text category value.
|
|
266
|
+
|
|
267
|
+
###### `tiles.<id>.where.<id>` with `number`
|
|
268
|
+
|
|
269
|
+
A numeric category value.
|
|
270
|
+
|
|
271
|
+
###### `tiles.<id>.where.<id>` with `list of strings or numbers`
|
|
272
|
+
|
|
273
|
+
Allowed values for the dimension.
|
|
274
|
+
|
|
275
|
+
#### `tiles.<id>` with `type: line`
|
|
276
|
+
|
|
277
|
+
A line tile. Missing time periods appear as gaps, never as zeros.
|
|
278
|
+
|
|
279
|
+
| Key | Type | Required | Description |
|
|
280
|
+
|---|---|---|---|
|
|
281
|
+
| `type` | `line` | yes | Plots measures over time or ordered categories. |
|
|
282
|
+
| `model` | string | no | The model whose dimensions and measures the tile shows. Required when the dashboard has more than one model. |
|
|
283
|
+
| `x` | string | yes | Date dimension (with optional `@day\|week\|month\|quarter\|year`) or category dimension for the horizontal axis. |
|
|
284
|
+
| `y` | string or list of strings | yes | A measure name, or a list of measures for multi-series charts. |
|
|
285
|
+
| `color` | string | no | Dimension whose categories split the measure into coloured series. |
|
|
286
|
+
| `where` | mapping of IDs (see below) | no | Per-tile equality filter mapping dimension names to exact value(s). |
|
|
287
|
+
| `title` | string | no | The tile's heading. Generated from `y` and `x` when omitted. |
|
|
288
|
+
| `size` | `s` or `m` or `l` | no | Tile height override: `s` (compact), `m` (standard), or `l` (tall). |
|
|
289
|
+
| `crossfilter` | boolean | no | Set to `false` to opt this tile out of emitting and receiving cross-filter selections. |
|
|
290
|
+
|
|
291
|
+
##### `tiles.<id>.where.<id>`
|
|
292
|
+
|
|
293
|
+
Exact value or list of allowed values.
|
|
294
|
+
|
|
295
|
+
One of: `option 1`, `list of strings or numbers`.
|
|
296
|
+
|
|
297
|
+
###### `tiles.<id>.where.<id>` with `option 1`
|
|
298
|
+
|
|
299
|
+
A category value.
|
|
300
|
+
|
|
301
|
+
One of: `string`, `number`.
|
|
302
|
+
|
|
303
|
+
###### `tiles.<id>.where.<id>` with `string`
|
|
304
|
+
|
|
305
|
+
A text category value.
|
|
306
|
+
|
|
307
|
+
###### `tiles.<id>.where.<id>` with `number`
|
|
308
|
+
|
|
309
|
+
A numeric category value.
|
|
310
|
+
|
|
311
|
+
###### `tiles.<id>.where.<id>` with `list of strings or numbers`
|
|
312
|
+
|
|
313
|
+
Allowed values for the dimension.
|
|
314
|
+
|
|
315
|
+
#### `tiles.<id>` with `type: area`
|
|
316
|
+
|
|
317
|
+
An area tile. Areas start at zero, and missing time periods appear as gaps.
|
|
318
|
+
|
|
319
|
+
| Key | Type | Required | Description |
|
|
320
|
+
|---|---|---|---|
|
|
321
|
+
| `type` | `area` | yes | Plots filled trends over time, starting at zero. |
|
|
322
|
+
| `model` | string | no | The model whose dimensions and measures the tile shows. Required when the dashboard has more than one model. |
|
|
323
|
+
| `x` | string | yes | Date dimension (with optional `@day\|week\|month\|quarter\|year`) or category dimension for the horizontal axis. |
|
|
324
|
+
| `y` | string or list of strings | yes | A measure name, or a list of measures for multi-series charts. |
|
|
325
|
+
| `color` | string | no | Dimension whose categories split the measure into coloured series. |
|
|
326
|
+
| `stack` | `normal` or `percent` or `none` | no | Stacking mode for multi-series areas: `normal`, `percent`, or `none`. |
|
|
327
|
+
| `where` | mapping of IDs (see below) | no | Per-tile equality filter mapping dimension names to exact value(s). |
|
|
328
|
+
| `title` | string | no | The tile's heading. Generated from `y` and `x` when omitted. |
|
|
329
|
+
| `size` | `s` or `m` or `l` | no | Tile height override: `s` (compact), `m` (standard), or `l` (tall). |
|
|
330
|
+
| `crossfilter` | boolean | no | Set to `false` to opt this tile out of emitting and receiving cross-filter selections. |
|
|
331
|
+
|
|
332
|
+
##### `tiles.<id>.where.<id>`
|
|
333
|
+
|
|
334
|
+
Exact value or list of allowed values.
|
|
335
|
+
|
|
336
|
+
One of: `option 1`, `list of strings or numbers`.
|
|
337
|
+
|
|
338
|
+
###### `tiles.<id>.where.<id>` with `option 1`
|
|
339
|
+
|
|
340
|
+
A category value.
|
|
341
|
+
|
|
342
|
+
One of: `string`, `number`.
|
|
343
|
+
|
|
344
|
+
###### `tiles.<id>.where.<id>` with `string`
|
|
345
|
+
|
|
346
|
+
A text category value.
|
|
347
|
+
|
|
348
|
+
###### `tiles.<id>.where.<id>` with `number`
|
|
349
|
+
|
|
350
|
+
A numeric category value.
|
|
351
|
+
|
|
352
|
+
###### `tiles.<id>.where.<id>` with `list of strings or numbers`
|
|
353
|
+
|
|
354
|
+
Allowed values for the dimension.
|
|
355
|
+
|
|
356
|
+
#### `tiles.<id>` with `type: bar`
|
|
357
|
+
|
|
358
|
+
A bar tile. Bars start at zero and are sorted by value, largest first.
|
|
359
|
+
|
|
360
|
+
| Key | Type | Required | Description |
|
|
361
|
+
|---|---|---|---|
|
|
362
|
+
| `type` | `bar` | yes | Compares measures across the categories of a dimension. |
|
|
363
|
+
| `model` | string | no | The model whose dimensions and measures the tile shows. Required when the dashboard has more than one model. |
|
|
364
|
+
| `x` | string | yes | The dimension whose categories become the bars (dates may include `@day\|week\|month\|quarter\|year`). |
|
|
365
|
+
| `y` | string or list of strings | yes | A measure name, or a list of measures for multi-series charts. |
|
|
366
|
+
| `color` | string | no | Dimension whose categories split the measure into coloured series. |
|
|
367
|
+
| `sort` | string | no | Sort order: `-y`, `y`, `x`, `-x`, or a measure name with optional leading `-`. |
|
|
368
|
+
| `limit` | number | no | Keep the top categories and roll the remainder into "Other". |
|
|
369
|
+
| `stack` | `normal` or `percent` or `none` | no | Stacking mode for multi-series bars: `normal`, `percent`, or `none`. |
|
|
370
|
+
| `horizontal` | boolean | no | Set `true` to render horizontal bars. |
|
|
371
|
+
| `where` | mapping of IDs (see below) | no | Per-tile equality filter mapping dimension names to exact value(s). |
|
|
372
|
+
| `title` | string | no | The tile's heading. Generated from `y` and `x` when omitted. |
|
|
373
|
+
| `size` | `s` or `m` or `l` | no | Tile height override: `s` (compact), `m` (standard), or `l` (tall). |
|
|
374
|
+
| `crossfilter` | boolean | no | Set to `false` to opt this tile out of emitting and receiving cross-filter selections. |
|
|
375
|
+
|
|
376
|
+
##### `tiles.<id>.where.<id>`
|
|
377
|
+
|
|
378
|
+
Exact value or list of allowed values.
|
|
379
|
+
|
|
380
|
+
One of: `option 1`, `list of strings or numbers`.
|
|
381
|
+
|
|
382
|
+
###### `tiles.<id>.where.<id>` with `option 1`
|
|
383
|
+
|
|
384
|
+
A category value.
|
|
385
|
+
|
|
386
|
+
One of: `string`, `number`.
|
|
387
|
+
|
|
388
|
+
###### `tiles.<id>.where.<id>` with `string`
|
|
389
|
+
|
|
390
|
+
A text category value.
|
|
391
|
+
|
|
392
|
+
###### `tiles.<id>.where.<id>` with `number`
|
|
393
|
+
|
|
394
|
+
A numeric category value.
|
|
395
|
+
|
|
396
|
+
###### `tiles.<id>.where.<id>` with `list of strings or numbers`
|
|
397
|
+
|
|
398
|
+
Allowed values for the dimension.
|
|
399
|
+
|
|
400
|
+
#### `tiles.<id>` with `type: combo`
|
|
401
|
+
|
|
402
|
+
A combo chart tile pairing bars and lines on dual axes.
|
|
403
|
+
|
|
404
|
+
| Key | Type | Required | Description |
|
|
405
|
+
|---|---|---|---|
|
|
406
|
+
| `type` | `combo` | yes | Plots bars (`y`, left axis) and lines (`y2`, right axis) together. |
|
|
407
|
+
| `model` | string | no | The model whose dimensions and measures the tile shows. Required when the dashboard has more than one model. |
|
|
408
|
+
| `x` | string | yes | Date dimension (with optional `@day\|week\|month\|quarter\|year`) or category dimension for the horizontal axis. |
|
|
409
|
+
| `y` | string or list of strings | yes | Measure(s) plotted as bars on the left vertical axis. |
|
|
410
|
+
| `y2` | string or list of strings | yes | Measure(s) plotted as lines on the right vertical axis. |
|
|
411
|
+
| `where` | mapping of IDs (see below) | no | Per-tile equality filter mapping dimension names to exact value(s). |
|
|
412
|
+
| `title` | string | no | The tile's heading. Generated from `y`, `y2` and `x` when omitted. |
|
|
413
|
+
| `size` | `s` or `m` or `l` | no | Tile height override: `s` (compact), `m` (standard), or `l` (tall). |
|
|
414
|
+
| `crossfilter` | boolean | no | Set to `false` to opt this tile out of emitting and receiving cross-filter selections. |
|
|
415
|
+
|
|
416
|
+
##### `tiles.<id>.where.<id>`
|
|
417
|
+
|
|
418
|
+
Exact value or list of allowed values.
|
|
419
|
+
|
|
420
|
+
One of: `option 1`, `list of strings or numbers`.
|
|
421
|
+
|
|
422
|
+
###### `tiles.<id>.where.<id>` with `option 1`
|
|
423
|
+
|
|
424
|
+
A category value.
|
|
425
|
+
|
|
426
|
+
One of: `string`, `number`.
|
|
427
|
+
|
|
428
|
+
###### `tiles.<id>.where.<id>` with `string`
|
|
429
|
+
|
|
430
|
+
A text category value.
|
|
431
|
+
|
|
432
|
+
###### `tiles.<id>.where.<id>` with `number`
|
|
433
|
+
|
|
434
|
+
A numeric category value.
|
|
435
|
+
|
|
436
|
+
###### `tiles.<id>.where.<id>` with `list of strings or numbers`
|
|
437
|
+
|
|
438
|
+
Allowed values for the dimension.
|
|
439
|
+
|
|
440
|
+
#### `tiles.<id>` with `type: scatter`
|
|
441
|
+
|
|
442
|
+
A scatter plot tile comparing two measures across entities.
|
|
443
|
+
|
|
444
|
+
| Key | Type | Required | Description |
|
|
445
|
+
|---|---|---|---|
|
|
446
|
+
| `type` | `scatter` | yes | Plots two measures against each other, one point per member of `by`. |
|
|
447
|
+
| `model` | string | no | The model whose dimensions and measures the tile shows. Required when the dashboard has more than one model. |
|
|
448
|
+
| `by` | string | yes | Dimension whose members become the plotted points (such as `customer`). |
|
|
449
|
+
| `x` | string | yes | Measure plotted along the horizontal axis. |
|
|
450
|
+
| `y` | string | yes | Measure plotted along the vertical axis. |
|
|
451
|
+
| `size` | string | no | Optional measure scaling point area. |
|
|
452
|
+
| `color` | string | no | Optional dimension splitting points into coloured series. |
|
|
453
|
+
| `where` | mapping of IDs (see below) | no | Per-tile equality filter mapping dimension names to exact value(s). |
|
|
454
|
+
| `title` | string | no | The tile's heading. Generated from `y`, `x` and `by` when omitted. |
|
|
455
|
+
| `crossfilter` | boolean | no | Set to `false` to opt this tile out of emitting and receiving cross-filter selections. |
|
|
456
|
+
|
|
457
|
+
##### `tiles.<id>.where.<id>`
|
|
458
|
+
|
|
459
|
+
Exact value or list of allowed values.
|
|
460
|
+
|
|
461
|
+
One of: `option 1`, `list of strings or numbers`.
|
|
462
|
+
|
|
463
|
+
###### `tiles.<id>.where.<id>` with `option 1`
|
|
464
|
+
|
|
465
|
+
A category value.
|
|
466
|
+
|
|
467
|
+
One of: `string`, `number`.
|
|
468
|
+
|
|
469
|
+
###### `tiles.<id>.where.<id>` with `string`
|
|
470
|
+
|
|
471
|
+
A text category value.
|
|
472
|
+
|
|
473
|
+
###### `tiles.<id>.where.<id>` with `number`
|
|
474
|
+
|
|
475
|
+
A numeric category value.
|
|
476
|
+
|
|
477
|
+
###### `tiles.<id>.where.<id>` with `list of strings or numbers`
|
|
478
|
+
|
|
479
|
+
Allowed values for the dimension.
|
|
480
|
+
|
|
481
|
+
#### `tiles.<id>` with `type: donut`
|
|
482
|
+
|
|
483
|
+
A donut chart tile capped at 6 slices.
|
|
484
|
+
|
|
485
|
+
| Key | Type | Required | Description |
|
|
486
|
+
|---|---|---|---|
|
|
487
|
+
| `type` | `donut` | yes | Shows part-to-whole shares across up to 6 slices of one dimension. |
|
|
488
|
+
| `model` | string | no | The model whose dimensions and measures the tile shows. Required when the dashboard has more than one model. |
|
|
489
|
+
| `by` | string | yes | Dimension whose categories become the donut slices (dates may include `@day\|week\|month\|quarter\|year`). |
|
|
490
|
+
| `value` | string | yes | Measure determining each slice's size. |
|
|
491
|
+
| `where` | mapping of IDs (see below) | no | Per-tile equality filter mapping dimension names to exact value(s). |
|
|
492
|
+
| `title` | string | no | The tile's heading. Generated from `value` and `by` when omitted. |
|
|
493
|
+
| `size` | `s` or `m` or `l` | no | Tile height override: `s` (compact), `m` (standard), or `l` (tall). |
|
|
494
|
+
| `crossfilter` | boolean | no | Set to `false` to opt this tile out of emitting and receiving cross-filter selections. |
|
|
495
|
+
|
|
496
|
+
##### `tiles.<id>.where.<id>`
|
|
497
|
+
|
|
498
|
+
Exact value or list of allowed values.
|
|
499
|
+
|
|
500
|
+
One of: `option 1`, `list of strings or numbers`.
|
|
501
|
+
|
|
502
|
+
###### `tiles.<id>.where.<id>` with `option 1`
|
|
503
|
+
|
|
504
|
+
A category value.
|
|
505
|
+
|
|
506
|
+
One of: `string`, `number`.
|
|
507
|
+
|
|
508
|
+
###### `tiles.<id>.where.<id>` with `string`
|
|
509
|
+
|
|
510
|
+
A text category value.
|
|
511
|
+
|
|
512
|
+
###### `tiles.<id>.where.<id>` with `number`
|
|
513
|
+
|
|
514
|
+
A numeric category value.
|
|
515
|
+
|
|
516
|
+
###### `tiles.<id>.where.<id>` with `list of strings or numbers`
|
|
517
|
+
|
|
518
|
+
Allowed values for the dimension.
|
|
519
|
+
|
|
520
|
+
#### `tiles.<id>` with `type: heatmap`
|
|
521
|
+
|
|
522
|
+
A heatmap tile comparing one measure across two category dimensions.
|
|
523
|
+
|
|
524
|
+
| Key | Type | Required | Description |
|
|
525
|
+
|---|---|---|---|
|
|
526
|
+
| `type` | `heatmap` | yes | Shows one measure as colour across pairs of `x` and `y` categories. |
|
|
527
|
+
| `model` | string | no | The model whose dimensions and measures the tile shows. Required when the dashboard has more than one model. |
|
|
528
|
+
| `x` | string | yes | Dimension along the horizontal axis (dates may include `@day\|week\|month\|quarter\|year`). |
|
|
529
|
+
| `y` | string | yes | Dimension along the vertical axis (dates may include `@day\|week\|month\|quarter\|year`). |
|
|
530
|
+
| `color` | string | yes | Measure encoded as cell colour intensity. |
|
|
531
|
+
| `where` | mapping of IDs (see below) | no | Per-tile equality filter mapping dimension names to exact value(s). |
|
|
532
|
+
| `title` | string | no | The tile's heading. Generated from `color`, `x` and `y` when omitted. |
|
|
533
|
+
| `size` | `s` or `m` or `l` | no | Tile height override: `s` (compact), `m` (standard), or `l` (tall). |
|
|
534
|
+
| `crossfilter` | boolean | no | Set to `false` to opt this tile out of emitting and receiving cross-filter selections. |
|
|
535
|
+
|
|
536
|
+
##### `tiles.<id>.where.<id>`
|
|
537
|
+
|
|
538
|
+
Exact value or list of allowed values.
|
|
539
|
+
|
|
540
|
+
One of: `option 1`, `list of strings or numbers`.
|
|
541
|
+
|
|
542
|
+
###### `tiles.<id>.where.<id>` with `option 1`
|
|
543
|
+
|
|
544
|
+
A category value.
|
|
545
|
+
|
|
546
|
+
One of: `string`, `number`.
|
|
547
|
+
|
|
548
|
+
###### `tiles.<id>.where.<id>` with `string`
|
|
549
|
+
|
|
550
|
+
A text category value.
|
|
551
|
+
|
|
552
|
+
###### `tiles.<id>.where.<id>` with `number`
|
|
553
|
+
|
|
554
|
+
A numeric category value.
|
|
555
|
+
|
|
556
|
+
###### `tiles.<id>.where.<id>` with `list of strings or numbers`
|
|
557
|
+
|
|
558
|
+
Allowed values for the dimension.
|
|
559
|
+
|
|
560
|
+
#### `tiles.<id>` with `type: table`
|
|
561
|
+
|
|
562
|
+
A tabular data tile with header sorting and row cross-filtering.
|
|
563
|
+
|
|
564
|
+
| Key | Type | Required | Description |
|
|
565
|
+
|---|---|---|---|
|
|
566
|
+
| `type` | `table` | yes | Shows sortable detail rows across dimensions and measures. |
|
|
567
|
+
| `model` | string | no | The model whose dimensions and measures the tile shows. Required when the dashboard has more than one model. |
|
|
568
|
+
| `columns` | list of items of several kinds (see below) | yes | Columns to display, mixing dimensions and measures in order. |
|
|
569
|
+
| `sort` | string | no | Default sort column name with optional leading `-` for descending order. |
|
|
570
|
+
| `limit` | number | no | Maximum number of rows to display. |
|
|
571
|
+
| `where` | mapping of IDs (see below) | no | Per-tile equality filter mapping dimension names to exact value(s). |
|
|
572
|
+
| `title` | string | no | The tile's heading. Generated from the columns when omitted. |
|
|
573
|
+
| `size` | `s` or `m` or `l` | no | Tile height override: `s` (compact), `m` (standard), or `l` (tall). |
|
|
574
|
+
| `crossfilter` | boolean | no | Set to `false` to opt this tile out of emitting and receiving cross-filter selections. |
|
|
575
|
+
|
|
576
|
+
##### `tiles.<id>.columns[]`
|
|
577
|
+
|
|
578
|
+
A field name or column configuration mapping.
|
|
579
|
+
|
|
580
|
+
One of: `string`, `field`.
|
|
581
|
+
|
|
582
|
+
###### `tiles.<id>.columns[]` with `string`
|
|
583
|
+
|
|
584
|
+
Dimension (with optional `@day|week|month|quarter|year`) or measure to show.
|
|
585
|
+
|
|
586
|
+
###### `tiles.<id>.columns[]` with `field`
|
|
587
|
+
|
|
588
|
+
A table column with display options.
|
|
589
|
+
|
|
590
|
+
| Key | Type | Required | Description |
|
|
591
|
+
|---|---|---|---|
|
|
592
|
+
| `field` | string | yes | Dimension (with optional `@day\|week\|month\|quarter\|year`) or measure to show. |
|
|
593
|
+
| `label` | string | no | Custom column header label. |
|
|
594
|
+
| `bar` | boolean | no | Set `true` on a measure column to render an inline proportional bar. |
|
|
595
|
+
| `color` | `scale` or `diverging` or `positive` or `negative` | no | Conditional colour shading for a measure column: `scale`, `diverging`, `positive`, or `negative`. |
|
|
596
|
+
|
|
597
|
+
##### `tiles.<id>.where.<id>`
|
|
598
|
+
|
|
599
|
+
Exact value or list of allowed values.
|
|
600
|
+
|
|
601
|
+
One of: `option 1`, `list of strings or numbers`.
|
|
602
|
+
|
|
603
|
+
###### `tiles.<id>.where.<id>` with `option 1`
|
|
604
|
+
|
|
605
|
+
A category value.
|
|
606
|
+
|
|
607
|
+
One of: `string`, `number`.
|
|
608
|
+
|
|
609
|
+
###### `tiles.<id>.where.<id>` with `string`
|
|
610
|
+
|
|
611
|
+
A text category value.
|
|
612
|
+
|
|
613
|
+
###### `tiles.<id>.where.<id>` with `number`
|
|
614
|
+
|
|
615
|
+
A numeric category value.
|
|
616
|
+
|
|
617
|
+
###### `tiles.<id>.where.<id>` with `list of strings or numbers`
|
|
618
|
+
|
|
619
|
+
Allowed values for the dimension.
|
|
620
|
+
|
|
621
|
+
#### `tiles.<id>` with `type: text`
|
|
622
|
+
|
|
623
|
+
A markdown text tile.
|
|
624
|
+
|
|
625
|
+
| Key | Type | Required | Description |
|
|
626
|
+
|---|---|---|---|
|
|
627
|
+
| `type` | `text` | yes | Renders sanitised markdown for notes, caveats and section headings. |
|
|
628
|
+
| `md` | string | yes | Markdown content. Raw HTML is escaped and remote images are stripped. |
|
|
629
|
+
| `title` | string | no | Optional heading displayed above the note. |
|
|
630
|
+
| `size` | `s` or `m` or `l` | no | Tile height override: `s` (compact), `m` (standard), or `l` (tall). |
|
|
631
|
+
|
|
632
|
+
### `theme`
|
|
633
|
+
|
|
634
|
+
Visual theme options: colour mode, accent colour and spacing density.
|
|
635
|
+
|
|
636
|
+
| Key | Type | Required | Description |
|
|
637
|
+
|---|---|---|---|
|
|
638
|
+
| `mode` | `auto` or `light` or `dark` | no | Colour scheme mode: `auto` (follows the OS setting), `light`, or `dark`. |
|
|
639
|
+
| `accent` | string | no | 6-digit hex accent colour used for highlights, single-series marks and palette. |
|
|
640
|
+
| `density` | `compact` or `comfortable` | no | Spacing density: `comfortable` (default) or `compact`. |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Tile guide: choosing the right tile
|
|
2
|
+
|
|
3
|
+
Match your data shape and question to one of flatbi's 10 tile types. Every tile type renders with opinionated defaults under a strict offline Content-Security-Policy.
|
|
4
|
+
|
|
5
|
+
## Your data → which tile
|
|
6
|
+
|
|
7
|
+
| Question & data shape | Tile type | Key fields | Defaults & guardrails |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| **Headline number** (1 measure, optional prior comparison & trend) | `kpi` | `value`, `compare` or `target`, `good`, `spark` | Shows `—` (never `0`) when empty; `compare` anchors to the active bounded `date_range` filter |
|
|
10
|
+
| **Continuous trend over time** (date@grain × 1+ measures) | `line` | `x: date@grain`, `y`, `color` | Chronological x-axis, tidy y-axis range, missing periods rendered as gaps (never zero) |
|
|
11
|
+
| **Cumulative or volume trend over time** (date@grain × 1+ measures) | `area` | `x: date@grain`, `y`, `color`, `stack` | Starts y-axis at zero; supports `stack: normal \| percent \| none` |
|
|
12
|
+
| **Compare categories or ranked items** (1 dim × 1+ measures) | `bar` | `x`, `y`, `color`, `sort`, `limit`, `horizontal`, `stack` | Starts at zero, sorted largest-first (`-y`) unless `order` or date; caps `color` at 8 series |
|
|
13
|
+
| **Volume + rate on two scales** (dim/date × bar measure + line measure) | `combo` | `x`, `y` (bars, left), `y2` (lines, right) | Left bar axis + right line axis; fills time gaps when `x` uses `@grain` |
|
|
14
|
+
| **Relationship between two measures** (entities × 2–3 measures) | `scatter` | `by`, `x`, `y`, `size`, `color` | One point per `by` member; optional bubble `size` measure and `color` series split |
|
|
15
|
+
| **Part-to-whole composition** (1 low-cardinality dim × 1 measure) | `donut` | `by`, `value` | Capped at 6 slices; smaller slices roll into `"Other"` with a warning |
|
|
16
|
+
| **Pattern across two categories** (2 dims × 1 measure) | `heatmap` | `x`, `y`, `color` | Matrix shaded by `color` measure; clicking a cell cross-filters both dimensions |
|
|
17
|
+
| **Exact numbers & multi-column detail** (mixed dims & measures) | `table` | `columns`, `sort`, `limit` | Interactive header sorting, per-column inline `bar: true` & conditional `color`, row cross-filter |
|
|
18
|
+
| **Caveats, definitions, or section headings** (markdown prose) | `text` | `md`, optional `title` | Sanitised markdown (headings, lists, links); strips raw HTML and remote images |
|
|
19
|
+
|
|
20
|
+
## Time grains, caps, and layout
|
|
21
|
+
|
|
22
|
+
- **Time grains (`@day`, `@week`, `@month`, `@quarter`, `@year`)**: Attach a grain suffix directly to a date dimension (such as `order_date@month`). ISO 8601 Monday-start weeks are used for `@week`.
|
|
23
|
+
- **Series and slice caps**: Keep categories readable. `bar` and `scatter` cap `color` splits at 8 series and `donut` caps slices at 6, rolling any overflow into `"Other"` with re-aggregated measures and emitting a `series-truncated` warning in `check`. Use `limit:` on `bar` or `table` to focus on top items.
|
|
24
|
+
- **Per-tile `where` and `crossfilter`**: Restrict a tile to an exact dimension subset with `where: { status: paid }` (or a list of values). Set `crossfilter: false` on reference KPIs or overview tiles that should ignore clicks from sibling tiles.
|
|
25
|
+
- **Heights (`size: s | m | l`) and 12-column `layout`**: Every tile defaults to a height suited to its type; override with `size: s | m | l` when a compact KPI or tall chart needs more room. Layout rows place `tileId` or `tileId:span` on a 12-column grid (omitted spans split the remaining columns equally) and automatically collapse to 6 columns below `900px` and 1 column below `600px`.
|