@bonnard/cli 0.2.15 → 0.2.16
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/README.md +2 -2
- package/dist/bin/bon.mjs +148 -2
- package/dist/docs/topics/sdk.apexcharts.md +281 -0
- package/dist/docs/topics/sdk.authentication.md +130 -0
- package/dist/docs/topics/sdk.browser.md +181 -0
- package/dist/docs/topics/sdk.chartjs.md +327 -0
- package/dist/docs/topics/sdk.echarts.md +297 -0
- package/dist/docs/topics/sdk.md +95 -0
- package/dist/docs/topics/sdk.query-reference.md +307 -0
- package/dist/templates/claude/skills/bonnard-build-dashboard/SKILL.md +107 -0
- package/dist/templates/claude/skills/bonnard-get-started/SKILL.md +1 -1
- package/dist/templates/claude/skills/bonnard-metabase-migrate/SKILL.md +1 -1
- package/dist/templates/cursor/rules/bonnard-build-dashboard.mdc +106 -0
- package/dist/templates/cursor/rules/bonnard-get-started.mdc +1 -1
- package/dist/templates/cursor/rules/bonnard-metabase-migrate.mdc +1 -1
- package/dist/templates/shared/bonnard.md +6 -1
- package/package.json +2 -2
- package/dist/docs/topics/dashboards.components.md +0 -246
- package/dist/docs/topics/dashboards.examples.md +0 -343
- package/dist/docs/topics/dashboards.inputs.md +0 -173
- package/dist/docs/topics/dashboards.md +0 -115
- package/dist/docs/topics/dashboards.queries.md +0 -112
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bonnard-build-dashboard
|
|
3
|
+
description: Guide a user through building and deploying a data dashboard using the Bonnard SDK and Chart.js. Use when user says "build a dashboard", "create a chart", "visualize data", or wants to deploy an HTML dashboard.
|
|
4
|
+
allowed-tools: Bash(bon *)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Build & Deploy a Dashboard
|
|
8
|
+
|
|
9
|
+
This skill guides you through creating an HTML dashboard powered by the
|
|
10
|
+
Bonnard SDK and deploying it as a hosted dashboard.
|
|
11
|
+
|
|
12
|
+
## Phase 1: Get the Starter Template
|
|
13
|
+
|
|
14
|
+
Fetch the SDK + Chart.js starter template:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
bon docs sdk.chartjs
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
This shows a working HTML template with `@bonnard/sdk` loaded from CDN and
|
|
21
|
+
a Chart.js example. Copy this as your starting point.
|
|
22
|
+
|
|
23
|
+
## Phase 2: Explore Available Data
|
|
24
|
+
|
|
25
|
+
Discover what measures and dimensions are available to query:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# List all views and their fields
|
|
29
|
+
bon docs schema
|
|
30
|
+
|
|
31
|
+
# Query a specific view to see what data looks like
|
|
32
|
+
bon query '{"measures": ["view_name.measure"], "dimensions": ["view_name.dimension"], "limit": 5}'
|
|
33
|
+
|
|
34
|
+
# Or use SQL format
|
|
35
|
+
bon query --sql "SELECT MEASURE(total_revenue), date FROM sales_performance LIMIT 5"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Ask the user what data they want to visualize. Match their request to
|
|
39
|
+
available views and measures.
|
|
40
|
+
|
|
41
|
+
## Phase 3: Build the HTML File
|
|
42
|
+
|
|
43
|
+
Create an HTML file that:
|
|
44
|
+
1. Loads `@bonnard/sdk` from CDN (see the template from Phase 1)
|
|
45
|
+
2. Initializes the SDK with a publishable key placeholder
|
|
46
|
+
3. Queries the semantic layer for the data the user wants
|
|
47
|
+
4. Renders charts using Chart.js (or another chart library)
|
|
48
|
+
|
|
49
|
+
Key points:
|
|
50
|
+
- The SDK uses `Bonnard.query()` to fetch data from the deployed semantic layer
|
|
51
|
+
- Use the view names and measure/dimension names from Phase 2
|
|
52
|
+
- The publishable key will be provided by the user or can be created with `bon keys create`
|
|
53
|
+
- Keep the HTML self-contained (inline CSS/JS, load libraries from CDN)
|
|
54
|
+
|
|
55
|
+
Save the file (e.g., `dashboard.html`).
|
|
56
|
+
|
|
57
|
+
## Phase 4: Preview Locally
|
|
58
|
+
|
|
59
|
+
Let the user preview the file in their browser before deploying.
|
|
60
|
+
They'll need to set a valid publishable key in the HTML first.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Create a publishable key if needed
|
|
64
|
+
bon keys create --name "Dashboard" --type publishable
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Phase 5: Deploy
|
|
68
|
+
|
|
69
|
+
Deploy the HTML file as a hosted dashboard on Bonnard:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
bon dashboard deploy dashboard.html
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
This will:
|
|
76
|
+
- Upload the HTML content
|
|
77
|
+
- Assign a slug (derived from filename, or use `--slug`)
|
|
78
|
+
- Print the public URL where the dashboard is accessible
|
|
79
|
+
|
|
80
|
+
Options:
|
|
81
|
+
- `--slug <slug>` — custom URL slug (default: derived from filename)
|
|
82
|
+
- `--title <title>` — dashboard title (default: from `<title>` tag)
|
|
83
|
+
|
|
84
|
+
## Phase 6: View Live
|
|
85
|
+
|
|
86
|
+
Open the deployed dashboard in the browser:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
bon dashboard open dashboard
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Iteration
|
|
93
|
+
|
|
94
|
+
To update the dashboard, edit the HTML file and redeploy:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
bon dashboard deploy dashboard.html
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Each deploy increments the version. Use `bon dashboard list` to see all
|
|
101
|
+
deployed dashboards with their versions and URLs.
|
|
102
|
+
|
|
103
|
+
To remove a dashboard:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
bon dashboard remove dashboard
|
|
107
|
+
```
|
|
@@ -30,7 +30,7 @@ bon datasource add --name my_warehouse --type postgres \
|
|
|
30
30
|
bon datasource add
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Supported types: `postgres`, `redshift`, `snowflake`, `bigquery`, `databricks`.
|
|
33
|
+
Supported types: `postgres`, `redshift`, `snowflake`, `bigquery`, `databricks`, `duckdb`.
|
|
34
34
|
|
|
35
35
|
The demo option adds a read-only Contoso retail dataset with tables like
|
|
36
36
|
`fact_sales`, `dim_product`, `dim_store`, and `dim_customer`.
|
|
@@ -65,7 +65,7 @@ bon datasource add --from-dbt
|
|
|
65
65
|
bon datasource add
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Supported types: `postgres`, `redshift`, `snowflake`, `bigquery`, `databricks`.
|
|
68
|
+
Supported types: `postgres`, `redshift`, `snowflake`, `bigquery`, `databricks`, `duckdb`.
|
|
69
69
|
|
|
70
70
|
The connection will be tested automatically during `bon deploy`.
|
|
71
71
|
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Guide for building and deploying data dashboards using the Bonnard SDK and Chart.js. Use when user says 'build a dashboard', 'create a chart', 'visualize data', or wants to deploy an HTML dashboard."
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build & Deploy a Dashboard
|
|
7
|
+
|
|
8
|
+
This guide walks through creating an HTML dashboard powered by the
|
|
9
|
+
Bonnard SDK and deploying it as a hosted dashboard.
|
|
10
|
+
|
|
11
|
+
## Phase 1: Get the Starter Template
|
|
12
|
+
|
|
13
|
+
Fetch the SDK + Chart.js starter template:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bon docs sdk.chartjs
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This shows a working HTML template with `@bonnard/sdk` loaded from CDN and
|
|
20
|
+
a Chart.js example. Copy this as your starting point.
|
|
21
|
+
|
|
22
|
+
## Phase 2: Explore Available Data
|
|
23
|
+
|
|
24
|
+
Discover what measures and dimensions are available to query:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# List all views and their fields
|
|
28
|
+
bon docs schema
|
|
29
|
+
|
|
30
|
+
# Query a specific view to see what data looks like
|
|
31
|
+
bon query '{"measures": ["view_name.measure"], "dimensions": ["view_name.dimension"], "limit": 5}'
|
|
32
|
+
|
|
33
|
+
# Or use SQL format
|
|
34
|
+
bon query --sql "SELECT MEASURE(total_revenue), date FROM sales_performance LIMIT 5"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Ask the user what data they want to visualize. Match their request to
|
|
38
|
+
available views and measures.
|
|
39
|
+
|
|
40
|
+
## Phase 3: Build the HTML File
|
|
41
|
+
|
|
42
|
+
Create an HTML file that:
|
|
43
|
+
1. Loads `@bonnard/sdk` from CDN (see the template from Phase 1)
|
|
44
|
+
2. Initializes the SDK with a publishable key placeholder
|
|
45
|
+
3. Queries the semantic layer for the data the user wants
|
|
46
|
+
4. Renders charts using Chart.js (or another chart library)
|
|
47
|
+
|
|
48
|
+
Key points:
|
|
49
|
+
- The SDK uses `Bonnard.query()` to fetch data from the deployed semantic layer
|
|
50
|
+
- Use the view names and measure/dimension names from Phase 2
|
|
51
|
+
- The publishable key will be provided by the user or can be created with `bon keys create`
|
|
52
|
+
- Keep the HTML self-contained (inline CSS/JS, load libraries from CDN)
|
|
53
|
+
|
|
54
|
+
Save the file (e.g., `dashboard.html`).
|
|
55
|
+
|
|
56
|
+
## Phase 4: Preview Locally
|
|
57
|
+
|
|
58
|
+
Let the user preview the file in their browser before deploying.
|
|
59
|
+
They'll need to set a valid publishable key in the HTML first.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Create a publishable key if needed
|
|
63
|
+
bon keys create --name "Dashboard" --type publishable
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Phase 5: Deploy
|
|
67
|
+
|
|
68
|
+
Deploy the HTML file as a hosted dashboard on Bonnard:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
bon dashboard deploy dashboard.html
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
This will:
|
|
75
|
+
- Upload the HTML content
|
|
76
|
+
- Assign a slug (derived from filename, or use `--slug`)
|
|
77
|
+
- Print the public URL where the dashboard is accessible
|
|
78
|
+
|
|
79
|
+
Options:
|
|
80
|
+
- `--slug <slug>` — custom URL slug (default: derived from filename)
|
|
81
|
+
- `--title <title>` — dashboard title (default: from `<title>` tag)
|
|
82
|
+
|
|
83
|
+
## Phase 6: View Live
|
|
84
|
+
|
|
85
|
+
Open the deployed dashboard in the browser:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
bon dashboard open dashboard
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Iteration
|
|
92
|
+
|
|
93
|
+
To update the dashboard, edit the HTML file and redeploy:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
bon dashboard deploy dashboard.html
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Each deploy increments the version. Use `bon dashboard list` to see all
|
|
100
|
+
deployed dashboards with their versions and URLs.
|
|
101
|
+
|
|
102
|
+
To remove a dashboard:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
bon dashboard remove dashboard
|
|
106
|
+
```
|
|
@@ -29,7 +29,7 @@ bon datasource add --name my_warehouse --type postgres \
|
|
|
29
29
|
bon datasource add
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Supported types: `postgres`, `redshift`, `snowflake`, `bigquery`, `databricks`.
|
|
32
|
+
Supported types: `postgres`, `redshift`, `snowflake`, `bigquery`, `databricks`, `duckdb`.
|
|
33
33
|
|
|
34
34
|
The demo option adds a read-only Contoso retail dataset with tables like
|
|
35
35
|
`fact_sales`, `dim_product`, `dim_store`, and `dim_customer`.
|
|
@@ -64,7 +64,7 @@ bon datasource add --from-dbt
|
|
|
64
64
|
bon datasource add
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
Supported types: `postgres`, `redshift`, `snowflake`, `bigquery`, `databricks`.
|
|
67
|
+
Supported types: `postgres`, `redshift`, `snowflake`, `bigquery`, `databricks`, `duckdb`.
|
|
68
68
|
|
|
69
69
|
The connection will be tested automatically during `bon deploy`.
|
|
70
70
|
|
|
@@ -5,7 +5,7 @@ Bonnard is a semantic layer platform that sits between your data warehouse and e
|
|
|
5
5
|
## How It Works
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
Data Warehouse (Snowflake, Postgres, BigQuery, Databricks)
|
|
8
|
+
Data Warehouse (Snowflake, Postgres, BigQuery, Databricks, DuckDB)
|
|
9
9
|
↓
|
|
10
10
|
Cubes (measures, dimensions, joins)
|
|
11
11
|
↓
|
|
@@ -73,6 +73,10 @@ All tables are in the `contoso` schema. The datasource is named `contoso_demo`.
|
|
|
73
73
|
| `bon query '{...}'` | Query the deployed semantic layer (requires `bon deploy` first, not for raw DB access) |
|
|
74
74
|
| `bon mcp` | Show MCP setup instructions for AI agents |
|
|
75
75
|
| `bon docs` | Browse documentation |
|
|
76
|
+
| `bon dashboard deploy <file>` | Deploy an HTML file as a hosted dashboard |
|
|
77
|
+
| `bon dashboard list` | List deployed dashboards with URLs |
|
|
78
|
+
| `bon dashboard remove <slug>` | Remove a deployed dashboard |
|
|
79
|
+
| `bon dashboard open <slug>` | Open a deployed dashboard in the browser |
|
|
76
80
|
| `bon metabase connect` | Connect to a Metabase instance (API key) |
|
|
77
81
|
| `bon metabase analyze` | Generate analysis report for semantic layer planning |
|
|
78
82
|
| `bon metabase explore` | Browse Metabase databases, collections, cards, dashboards |
|
|
@@ -110,6 +114,7 @@ Topics follow dot notation (e.g., `cubes.dimensions.time`). Use `--recursive` to
|
|
|
110
114
|
For a guided walkthrough: `/bonnard-get-started`
|
|
111
115
|
For projects migrating from Metabase: `/bonnard-metabase-migrate`
|
|
112
116
|
For design principles: `/bonnard-design-guide`
|
|
117
|
+
For building dashboards with SDK + charts: `/bonnard-build-dashboard`
|
|
113
118
|
|
|
114
119
|
## Deployment & Change Tracking
|
|
115
120
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonnard/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bon": "./dist/bin/bon.mjs"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "tsdown src/bin/bon.ts --format esm --out-dir dist/bin && cp -r src/templates dist/ && mkdir -p dist/docs/topics dist/docs/schemas && cp ./content/index.md dist/docs/_index.md && cp ./content/overview.md ./content/getting-started.md dist/docs/topics/ && cp ./content/modeling/*.md dist/docs/topics/ && cp ./content/
|
|
12
|
+
"build": "tsdown src/bin/bon.ts --format esm --out-dir dist/bin && cp -r src/templates dist/ && mkdir -p dist/docs/topics dist/docs/schemas && cp ./content/index.md dist/docs/_index.md && cp ./content/overview.md ./content/getting-started.md dist/docs/topics/ && cp ./content/modeling/*.md dist/docs/topics/ && cp ./content/sdk/*.md dist/docs/topics/",
|
|
13
13
|
"dev": "tsdown src/bin/bon.ts --format esm --out-dir dist/bin --watch",
|
|
14
14
|
"test": "vitest run"
|
|
15
15
|
},
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
# Components
|
|
2
|
-
|
|
3
|
-
> Chart and display components for rendering query results in dashboards.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
Components are self-closing HTML-style tags that render query results as charts, tables, or KPI cards. Each component takes a `data` prop referencing a named query.
|
|
8
|
-
|
|
9
|
-
Choose the component that best fits your data:
|
|
10
|
-
|
|
11
|
-
- **BigValue** — single KPI number (total revenue, order count)
|
|
12
|
-
- **LineChart** — trends over time
|
|
13
|
-
- **BarChart** — comparing categories (vertical or horizontal)
|
|
14
|
-
- **AreaChart** — cumulative or stacked trends
|
|
15
|
-
- **PieChart** — proportional breakdown (best with 5-7 slices)
|
|
16
|
-
- **DataTable** — detailed rows for drilling into data
|
|
17
|
-
|
|
18
|
-
## Syntax
|
|
19
|
-
|
|
20
|
-
```markdown
|
|
21
|
-
<ComponentName data={query_name} prop="value" />
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
- Components are self-closing (`/>`)
|
|
25
|
-
- `data` uses curly braces: `data={query_name}`
|
|
26
|
-
- Other props use quotes: `x="orders.city"`
|
|
27
|
-
- Boolean props can be shorthand: `horizontal`
|
|
28
|
-
|
|
29
|
-
## Component Reference
|
|
30
|
-
|
|
31
|
-
### BigValue
|
|
32
|
-
|
|
33
|
-
Displays a single KPI metric as a large number.
|
|
34
|
-
|
|
35
|
-
```markdown
|
|
36
|
-
<BigValue data={total_revenue} value="orders.total_revenue" title="Revenue" />
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
| Prop | Type | Required | Description |
|
|
40
|
-
|------|------|----------|-------------|
|
|
41
|
-
| `data` | query ref | Yes | Query name (should return a single row) |
|
|
42
|
-
| `value` | string | Yes | Fully qualified measure field name to display |
|
|
43
|
-
| `title` | string | No | Label above the value |
|
|
44
|
-
| `fmt` | string | No | Format preset or Excel code (e.g. `fmt="eur2"`, `fmt="$#,##0.00"`) |
|
|
45
|
-
|
|
46
|
-
### LineChart
|
|
47
|
-
|
|
48
|
-
Renders a line chart, typically for time series. Supports multiple y columns and series splitting.
|
|
49
|
-
|
|
50
|
-
```markdown
|
|
51
|
-
<LineChart data={monthly_revenue} x="orders.created_at" y="orders.total_revenue" title="Revenue Trend" />
|
|
52
|
-
<LineChart data={trend} x="orders.created_at" y="orders.total_revenue,orders.count" />
|
|
53
|
-
<LineChart data={revenue_by_type} x="orders.created_at" y="orders.total_revenue" series="orders.type" />
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
| Prop | Type | Required | Description |
|
|
57
|
-
|------|------|----------|-------------|
|
|
58
|
-
| `data` | query ref | Yes | Query name |
|
|
59
|
-
| `x` | string | Yes | Field for x-axis (typically a time dimension) |
|
|
60
|
-
| `y` | string | Yes | Field(s) for y-axis. Comma-separated for multiple (e.g. `y="orders.total_revenue,orders.count"`) |
|
|
61
|
-
| `title` | string | No | Chart title |
|
|
62
|
-
| `series` | string | No | Column to split data into separate colored lines |
|
|
63
|
-
| `type` | string | No | `"stacked"` for stacked lines (default: no stacking) |
|
|
64
|
-
| `yFmt` | string | No | Format preset or Excel code for tooltip values (e.g. `yFmt="eur2"`) |
|
|
65
|
-
|
|
66
|
-
### BarChart
|
|
67
|
-
|
|
68
|
-
Renders a vertical bar chart. Add `horizontal` for horizontal bars. Supports multi-series with stacked or grouped display.
|
|
69
|
-
|
|
70
|
-
```markdown
|
|
71
|
-
<BarChart data={revenue_by_city} x="orders.city" y="orders.total_revenue" />
|
|
72
|
-
<BarChart data={revenue_by_city} x="orders.city" y="orders.total_revenue" horizontal />
|
|
73
|
-
<BarChart data={revenue_by_type} x="orders.created_at" y="orders.total_revenue" series="orders.type" />
|
|
74
|
-
<BarChart data={revenue_by_type} x="orders.created_at" y="orders.total_revenue" series="orders.type" type="grouped" />
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
| Prop | Type | Required | Description |
|
|
78
|
-
|------|------|----------|-------------|
|
|
79
|
-
| `data` | query ref | Yes | Query name |
|
|
80
|
-
| `x` | string | Yes | Field for category axis |
|
|
81
|
-
| `y` | string | Yes | Field(s) for value axis. Comma-separated for multiple (e.g. `y="orders.total_revenue,orders.count"`) |
|
|
82
|
-
| `title` | string | No | Chart title |
|
|
83
|
-
| `horizontal` | boolean | No | Render as horizontal bar chart |
|
|
84
|
-
| `series` | string | No | Column to split data into separate colored bars |
|
|
85
|
-
| `type` | string | No | `"stacked"` (default) or `"grouped"` for multi-series display |
|
|
86
|
-
| `yFmt` | string | No | Format preset or Excel code for tooltip values (e.g. `yFmt="usd"`) |
|
|
87
|
-
|
|
88
|
-
### AreaChart
|
|
89
|
-
|
|
90
|
-
Renders a filled area chart. Supports series splitting and stacked areas.
|
|
91
|
-
|
|
92
|
-
```markdown
|
|
93
|
-
<AreaChart data={monthly_revenue} x="orders.created_at" y="orders.total_revenue" />
|
|
94
|
-
<AreaChart data={revenue_by_source} x="orders.created_at" y="orders.total_revenue" series="orders.source" type="stacked" />
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
| Prop | Type | Required | Description |
|
|
98
|
-
|------|------|----------|-------------|
|
|
99
|
-
| `data` | query ref | Yes | Query name |
|
|
100
|
-
| `x` | string | Yes | Field for x-axis |
|
|
101
|
-
| `y` | string | Yes | Field(s) for y-axis. Comma-separated for multiple (e.g. `y="orders.total_revenue,orders.count"`) |
|
|
102
|
-
| `title` | string | No | Chart title |
|
|
103
|
-
| `series` | string | No | Column to split data into separate colored areas |
|
|
104
|
-
| `type` | string | No | `"stacked"` for stacked areas (default: no stacking) |
|
|
105
|
-
| `yFmt` | string | No | Format preset or Excel code for tooltip values (e.g. `yFmt="pct1"`) |
|
|
106
|
-
|
|
107
|
-
### PieChart
|
|
108
|
-
|
|
109
|
-
Renders a pie/donut chart.
|
|
110
|
-
|
|
111
|
-
```markdown
|
|
112
|
-
<PieChart data={by_status} name="orders.status" value="orders.count" title="Order Status" />
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
| Prop | Type | Required | Description |
|
|
116
|
-
|------|------|----------|-------------|
|
|
117
|
-
| `data` | query ref | Yes | Query name |
|
|
118
|
-
| `name` | string | Yes | Field for slice labels |
|
|
119
|
-
| `value` | string | Yes | Field for slice values |
|
|
120
|
-
| `title` | string | No | Chart title |
|
|
121
|
-
|
|
122
|
-
### DataTable
|
|
123
|
-
|
|
124
|
-
Renders query results as a sortable, paginated table. Click any column header to sort ascending/descending.
|
|
125
|
-
|
|
126
|
-
```markdown
|
|
127
|
-
<DataTable data={top_products} />
|
|
128
|
-
<DataTable data={top_products} columns="orders.category,orders.total_revenue,orders.count" />
|
|
129
|
-
<DataTable data={top_products} rows="25" />
|
|
130
|
-
<DataTable data={top_products} rows="all" />
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
| Prop | Type | Required | Description |
|
|
134
|
-
|------|------|----------|-------------|
|
|
135
|
-
| `data` | query ref | Yes | Query name |
|
|
136
|
-
| `columns` | string | No | Comma-separated list of columns to show (default: all) |
|
|
137
|
-
| `title` | string | No | Table title |
|
|
138
|
-
| `fmt` | string | No | Column format map: `fmt="orders.total_revenue:eur2,orders.created_at:shortdate"` |
|
|
139
|
-
| `rows` | string | No | Rows per page. Default `10`. Use `rows="all"` to disable pagination. |
|
|
140
|
-
|
|
141
|
-
**Sorting:** Click a column header to sort ascending. Click again to sort descending. Null values always sort to the end. Numbers sort numerically, strings sort case-insensitively.
|
|
142
|
-
|
|
143
|
-
**Formatting:** Numbers right-align with tabular figures. Dates auto-detect and won't wrap. Use `fmt` for explicit formatting per column.
|
|
144
|
-
|
|
145
|
-
## Layout
|
|
146
|
-
|
|
147
|
-
### Auto BigValue Grouping
|
|
148
|
-
|
|
149
|
-
Consecutive `<BigValue>` components are automatically wrapped in a responsive grid — no `<Grid>` tag needed:
|
|
150
|
-
|
|
151
|
-
```markdown
|
|
152
|
-
<BigValue data={total_revenue} value="orders.total_revenue" title="Revenue" />
|
|
153
|
-
<BigValue data={order_count} value="orders.count" title="Orders" />
|
|
154
|
-
<BigValue data={avg_order} value="orders.avg_order_value" title="Avg Order" />
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
This renders as a 3-column row. The grid auto-sizes up to 4 columns based on the number of consecutive BigValues. For more control, use an explicit `<Grid>` tag.
|
|
158
|
-
|
|
159
|
-
### Grid
|
|
160
|
-
|
|
161
|
-
Wrap components in a `<Grid>` tag to arrange them in columns:
|
|
162
|
-
|
|
163
|
-
```markdown
|
|
164
|
-
<Grid cols="3">
|
|
165
|
-
<BigValue data={total_orders} value="orders.count" title="Orders" />
|
|
166
|
-
<BigValue data={total_revenue} value="orders.total_revenue" title="Revenue" />
|
|
167
|
-
<BigValue data={avg_order} value="orders.avg_order_value" title="Avg Order" />
|
|
168
|
-
</Grid>
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
| Prop | Type | Default | Description |
|
|
172
|
-
|------|------|---------|-------------|
|
|
173
|
-
| `cols` | string | `"2"` | Number of columns in the grid |
|
|
174
|
-
|
|
175
|
-
### Layout Best Practices
|
|
176
|
-
|
|
177
|
-
**Use `##` for sections, not `#`.** The `#` heading renders very large and wastes vertical space. Use `##` for section titles and `###` for subsections. Reserve `#` for the dashboard title only (which is set in frontmatter, not in the body).
|
|
178
|
-
|
|
179
|
-
**Group related charts side by side.** Wrap pairs of charts in `<Grid cols="2">` to avoid long vertical scrolling:
|
|
180
|
-
|
|
181
|
-
```markdown
|
|
182
|
-
<Grid cols="2">
|
|
183
|
-
<BarChart data={by_channel} x="orders.channel" y="orders.total_revenue" title="By Channel" />
|
|
184
|
-
<BarChart data={by_city} x="orders.city" y="orders.total_revenue" title="By City" horizontal />
|
|
185
|
-
</Grid>
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
**Start each section with KPIs.** Place `<BigValue>` cards at the top of a section for at-a-glance metrics, then follow with charts for detail.
|
|
189
|
-
|
|
190
|
-
**Only Grid together components of similar height.** Don't mix a `<BigValue>` with a chart in the same `<Grid>` row — the grid stretches both cells to the tallest item, leaving the BigValue card with a large empty area. Instead, place KPIs in their own row (consecutive BigValues auto-group) and pair charts with other charts of similar size.
|
|
191
|
-
|
|
192
|
-
**Keep it compact.** A good dashboard fits key information in 2-3 screens of scrolling. Use Grids, concise titles, and avoid unnecessary headings between every chart.
|
|
193
|
-
|
|
194
|
-
## Formatting
|
|
195
|
-
|
|
196
|
-
Values are auto-formatted by default — numbers get locale grouping (1,234.56), dates display as "13 Jan 2025", and nulls show as "—". Override with named presets for common currencies and percentages, or use raw Excel format codes for full control.
|
|
197
|
-
|
|
198
|
-
### Format Presets
|
|
199
|
-
|
|
200
|
-
| Preset | Excel code | Example output |
|
|
201
|
-
|--------|-----------|---------------|
|
|
202
|
-
| `num0` | `#,##0` | 1,234 |
|
|
203
|
-
| `num1` | `#,##0.0` | 1,234.6 |
|
|
204
|
-
| `num2` | `#,##0.00` | 1,234.56 |
|
|
205
|
-
| `usd` | `$#,##0` | $1,234 |
|
|
206
|
-
| `usd2` | `$#,##0.00` | $1,234.56 |
|
|
207
|
-
| `eur` | `#,##0 "€"` | 1,234 € |
|
|
208
|
-
| `eur2` | `#,##0.00 "€"` | 1,234.56 € |
|
|
209
|
-
| `gbp` | `£#,##0` | £1,234 |
|
|
210
|
-
| `gbp2` | `£#,##0.00` | £1,234.56 |
|
|
211
|
-
| `chf` | `"CHF "#,##0` | CHF 1,234 |
|
|
212
|
-
| `chf2` | `"CHF "#,##0.00` | CHF 1,234.56 |
|
|
213
|
-
| `pct` | `0%` | 45% |
|
|
214
|
-
| `pct1` | `0.0%` | 45.1% |
|
|
215
|
-
| `pct2` | `0.00%` | 45.12% |
|
|
216
|
-
| `shortdate` | `d mmm yyyy` | 13 Jan 2025 |
|
|
217
|
-
| `longdate` | `d mmmm yyyy` | 13 January 2025 |
|
|
218
|
-
| `monthyear` | `mmm yyyy` | Jan 2025 |
|
|
219
|
-
|
|
220
|
-
Any string that isn't a preset name is treated as a raw Excel format code (ECMA-376). For example: `fmt="orders.total_revenue:$#,##0.00"`.
|
|
221
|
-
|
|
222
|
-
Note: Percentage presets (`pct`, `pct1`, `pct2`) multiply by 100 per Excel convention — 0.45 displays as "45%".
|
|
223
|
-
|
|
224
|
-
### Usage Examples
|
|
225
|
-
|
|
226
|
-
```markdown
|
|
227
|
-
<!-- BigValue with currency -->
|
|
228
|
-
<BigValue data={total_revenue} value="orders.total_revenue" title="Revenue" fmt="eur2" />
|
|
229
|
-
|
|
230
|
-
<!-- DataTable with per-column formatting -->
|
|
231
|
-
<DataTable data={sales} fmt="orders.total_revenue:usd2,orders.created_at:shortdate,orders.margin:pct1" />
|
|
232
|
-
|
|
233
|
-
<!-- Chart with formatted tooltips -->
|
|
234
|
-
<BarChart data={monthly} x="orders.created_at" y="orders.total_revenue" yFmt="usd" />
|
|
235
|
-
<LineChart data={trend} x="orders.created_at" y="orders.growth" yFmt="pct1" />
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## Field Names
|
|
239
|
-
|
|
240
|
-
All field names in component props must be **fully qualified** with the view or cube name — the same format used in query blocks. For example, use `value="orders.total_revenue"` not `value="total_revenue"`.
|
|
241
|
-
|
|
242
|
-
## See Also
|
|
243
|
-
|
|
244
|
-
- [Queries](dashboards.queries) — query syntax and properties
|
|
245
|
-
- [Examples](dashboards.examples) — complete dashboard examples
|
|
246
|
-
- [Dashboards](dashboards) — overview and deployment
|