@graphenedata/cli 0.0.15 → 0.0.17
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 +174 -0
- package/dist/cli/bigQuery-OQUNH3VT.js +75 -0
- package/dist/cli/bigQuery-OQUNH3VT.js.map +7 -0
- package/dist/cli/chunk-56K2FF57.js +53 -0
- package/dist/cli/chunk-56K2FF57.js.map +7 -0
- package/dist/cli/chunk-TZTTALAV.js +12868 -0
- package/dist/cli/chunk-TZTTALAV.js.map +7 -0
- package/dist/cli/cli.js +260 -11196
- package/dist/cli/clickhouse-S3BJSKND.js +65 -0
- package/dist/cli/clickhouse-S3BJSKND.js.map +7 -0
- package/dist/cli/duckdb-TKVMONRK.js +87 -0
- package/dist/cli/duckdb-TKVMONRK.js.map +7 -0
- package/dist/cli/serve2-S2LL4D4D.js +448 -0
- package/dist/cli/serve2-S2LL4D4D.js.map +7 -0
- package/dist/cli/snowflake-3VPDEYYP.js +128 -0
- package/dist/cli/snowflake-3VPDEYYP.js.map +7 -0
- package/dist/index.d.ts +63 -0
- package/dist/lang/index.d.ts +63 -0
- package/dist/skills/graphene/SKILL.md +156 -95
- package/dist/skills/graphene/references/big-value.md +6 -41
- package/dist/skills/graphene/references/date-range.md +64 -0
- package/dist/skills/graphene/references/dropdown.md +3 -4
- package/dist/skills/graphene/references/echarts.md +162 -0
- package/dist/skills/graphene/references/gsql.md +55 -25
- package/dist/skills/graphene/references/model-gsql.md +70 -0
- package/dist/skills/graphene/references/table.md +13 -14
- package/dist/skills/graphene/references/text-input.md +2 -1
- package/dist/ui/app.css +239 -340
- package/dist/ui/component-utilities/dataShaping.ts +484 -0
- package/dist/ui/component-utilities/dataSummary.ts +57 -0
- package/dist/ui/component-utilities/enrich.ts +793 -0
- package/dist/ui/component-utilities/format.ts +177 -0
- package/dist/ui/component-utilities/inputUtils.ts +44 -8
- package/dist/ui/component-utilities/theme.ts +200 -0
- package/dist/ui/component-utilities/themeStores.ts +21 -8
- package/dist/ui/component-utilities/types.ts +70 -0
- package/dist/ui/components/AreaChart.svelte +57 -105
- package/dist/ui/components/BarChart.svelte +71 -129
- package/dist/ui/components/BigValue.svelte +24 -40
- package/dist/ui/components/Column.svelte +10 -18
- package/dist/ui/components/DateRange.svelte +54 -21
- package/dist/ui/components/Dropdown.svelte +47 -26
- package/dist/ui/components/DropdownOption.svelte +1 -2
- package/dist/ui/components/ECharts.svelte +181 -67
- package/dist/ui/components/InlineDelta.svelte +50 -31
- package/dist/ui/components/LineChart.svelte +54 -125
- package/dist/ui/components/PieChart.svelte +27 -37
- package/dist/ui/components/QueryLoad.svelte +77 -45
- package/dist/ui/components/Row.svelte +2 -1
- package/dist/ui/components/ScatterPlot.svelte +52 -0
- package/dist/ui/components/Skeleton.svelte +32 -0
- package/dist/ui/components/Table.svelte +3 -2
- package/dist/ui/components/TableGroupRow.svelte +28 -36
- package/dist/ui/components/TableHarness.svelte +32 -0
- package/dist/ui/components/TableHeader.svelte +34 -59
- package/dist/ui/components/TableRow.svelte +14 -38
- package/dist/ui/components/TableSubtotalRow.svelte +18 -21
- package/dist/ui/components/TableTotalRow.svelte +27 -37
- package/dist/ui/components/TextInput.svelte +13 -12
- package/dist/ui/components/Value.svelte +25 -0
- package/dist/ui/components/_Table.svelte +72 -70
- package/dist/ui/internal/ChartGallery.svelte +527 -0
- package/dist/ui/internal/ErrorDisplay.svelte +22 -97
- package/dist/ui/internal/LocalApp.svelte +84 -19
- package/dist/ui/internal/PageNavGroup.svelte +269 -0
- package/dist/ui/internal/Sidebar.svelte +178 -0
- package/dist/ui/internal/SidebarToggle.svelte +47 -0
- package/dist/ui/internal/StyleGallery.svelte +244 -0
- package/dist/ui/internal/clientCache.ts +2 -2
- package/dist/ui/internal/pageInputs.svelte.js +292 -0
- package/dist/ui/internal/queryEngine.ts +112 -129
- package/dist/ui/internal/runSocket.ts +31 -14
- package/dist/ui/internal/sidebar.svelte.js +18 -0
- package/dist/ui/internal/telemetry.ts +51 -16
- package/dist/ui/internal/types.d.ts +7 -0
- package/dist/ui/web.js +30 -11
- package/package.json +40 -38
- package/dist/skills/graphene/references/area-chart.md +0 -95
- package/dist/skills/graphene/references/bar-chart.md +0 -112
- package/dist/skills/graphene/references/line-chart.md +0 -108
- package/dist/skills/graphene/references/pie-chart.md +0 -29
- package/dist/skills/graphene/references/value-formats.md +0 -104
- package/dist/ui/component-utilities/autoFormatting.js +0 -280
- package/dist/ui/component-utilities/builtInFormats.js +0 -481
- package/dist/ui/component-utilities/chartContext.js +0 -12
- package/dist/ui/component-utilities/chartWindowDebug.js +0 -21
- package/dist/ui/component-utilities/checkInputs.js +0 -84
- package/dist/ui/component-utilities/convert.js +0 -15
- package/dist/ui/component-utilities/dateParsing.js +0 -56
- package/dist/ui/component-utilities/dropdownContext.ts +0 -1
- package/dist/ui/component-utilities/echarts.js +0 -252
- package/dist/ui/component-utilities/echartsThemes.js +0 -443
- package/dist/ui/component-utilities/formatTitle.js +0 -24
- package/dist/ui/component-utilities/formatting.js +0 -241
- package/dist/ui/component-utilities/getColumnExtents.js +0 -79
- package/dist/ui/component-utilities/getColumnSummary.js +0 -62
- package/dist/ui/component-utilities/getCompletedData.js +0 -122
- package/dist/ui/component-utilities/getDistinctCount.js +0 -7
- package/dist/ui/component-utilities/getDistinctValues.js +0 -15
- package/dist/ui/component-utilities/getSeriesConfig.js +0 -231
- package/dist/ui/component-utilities/getSortedData.js +0 -9
- package/dist/ui/component-utilities/getStackPercentages.js +0 -45
- package/dist/ui/component-utilities/getStackedData.js +0 -19
- package/dist/ui/component-utilities/getYAxisIndex.js +0 -15
- package/dist/ui/component-utilities/globalContexts.js +0 -1
- package/dist/ui/component-utilities/helpers/getCompletedData.helpers.js +0 -119
- package/dist/ui/component-utilities/replaceNulls.js +0 -16
- package/dist/ui/component-utilities/tableUtils.ts +0 -107
- package/dist/ui/component-utilities/tidyWithTypes.js +0 -9
- package/dist/ui/components/Area.svelte +0 -214
- package/dist/ui/components/Bar.svelte +0 -347
- package/dist/ui/components/Chart.svelte +0 -995
- package/dist/ui/components/Line.svelte +0 -227
- package/dist/ui/internal/NavSidebar.svelte +0 -396
- package/dist/ui/internal/theme.ts +0 -60
- package/dist/ui/public/inter-latin-ext.woff2 +0 -0
- package/dist/ui/public/inter-latin.woff2 +0 -0
|
@@ -17,8 +17,8 @@ table orders (
|
|
|
17
17
|
user_id BIGINT
|
|
18
18
|
created_at DATETIME
|
|
19
19
|
status STRING -- One of 'Processing', 'Shipped', 'Complete', 'Cancelled', 'Returned'
|
|
20
|
-
amount FLOAT -- Amount paid by customer
|
|
21
|
-
cost FLOAT -- Cost of materials
|
|
20
|
+
amount FLOAT -- Amount paid by customer #units=usd
|
|
21
|
+
cost FLOAT -- Cost of materials #units=usd
|
|
22
22
|
|
|
23
23
|
-- Join relationships
|
|
24
24
|
|
|
@@ -30,10 +30,10 @@ table orders (
|
|
|
30
30
|
|
|
31
31
|
-- Measures
|
|
32
32
|
|
|
33
|
-
revenue: sum(case when revenue_recognized then amount else 0 end)
|
|
34
|
-
cogs: sum(case when revenue_recognized then cost else 0 end)
|
|
35
|
-
profit: revenue - cogs
|
|
36
|
-
profit_margin: profit / revenue
|
|
33
|
+
revenue: sum(case when revenue_recognized then amount else 0 end) #units=usd
|
|
34
|
+
cogs: sum(case when revenue_recognized then cost else 0 end) #units=usd
|
|
35
|
+
profit: revenue - cogs #units=usd
|
|
36
|
+
profit_margin: profit / revenue #ratio
|
|
37
37
|
)
|
|
38
38
|
|
|
39
39
|
table users (
|
|
@@ -53,6 +53,16 @@ We can break down a `table` statement into three parts: base columns, join relat
|
|
|
53
53
|
|
|
54
54
|
The base column set is simply a reflection of the underlying database table's schema. Similar to `create table` statements in regular SQL DDL, you list each column's name and data type.
|
|
55
55
|
|
|
56
|
+
For array columns, GSQL uses `array<T>` as the standard syntax:
|
|
57
|
+
|
|
58
|
+
```sql
|
|
59
|
+
table events (
|
|
60
|
+
id BIGINT
|
|
61
|
+
tags array<string>
|
|
62
|
+
scores array<int64>
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
56
66
|
### Join relationships
|
|
57
67
|
|
|
58
68
|
Join relationships in a `table` statement declare joins that can be used when querying them. This makes query writing easier and more foolproof.
|
|
@@ -113,13 +123,33 @@ table orders (
|
|
|
113
123
|
revenue_recognized: status in ('Processing', 'Shipped', 'Complete')
|
|
114
124
|
|
|
115
125
|
/* Agg expressions */
|
|
116
|
-
revenue: sum(case when revenue_recognized then amount else 0 end)
|
|
117
|
-
cogs: sum(case when revenue_recognized then cost else 0 end)
|
|
118
|
-
profit: revenue - cogs -- even though there are no agg functions here, this is still aggregative as it references other aggregative expressions
|
|
119
|
-
profit_margin: profit / revenue
|
|
126
|
+
revenue: sum(case when revenue_recognized then amount else 0 end) #units=usd
|
|
127
|
+
cogs: sum(case when revenue_recognized then cost else 0 end) #units=usd
|
|
128
|
+
profit: revenue - cogs #units=usd -- even though there are no agg functions here, this is still aggregative as it references other aggregative expressions
|
|
129
|
+
profit_margin: profit / revenue #ratio
|
|
120
130
|
)
|
|
121
131
|
```
|
|
122
132
|
|
|
133
|
+
### Metadata annotations
|
|
134
|
+
|
|
135
|
+
Certain GSQL expressions will create field-level metadata that Graphene uses for better formatting and visualizations defaults. For example, `date_trunc('month', created_at)` will attach `timeGrain=month` metadata to the resulting column, which informs Graphene that the values represent months and not just days that happen to land on the first of every month. Graphene leverages this information to make sure that value formatting and chart axes look good by default.
|
|
136
|
+
|
|
137
|
+
There isn't always a SQL expression that can tip Graphene to the semantic meaning of a field, however:
|
|
138
|
+
- The field could be a base column that has no source expression
|
|
139
|
+
- There might not be enough information in the expression (eg. what currency a float is tied to)
|
|
140
|
+
|
|
141
|
+
For this reason, some metadata should be set explicitly in the GSQL model, using annotations. Metadata annotations resemble hashtags (eg. `#ratio`, `#units=usd`) that can be inlined or written above the object they decorate.
|
|
142
|
+
|
|
143
|
+
#### Recognized metadata
|
|
144
|
+
|
|
145
|
+
| Key | Inferrable? | Effect |
|
|
146
|
+
|---|---|---|
|
|
147
|
+
| `#ratio` | no | Value is 0–1; rendered as `value × 100%` (e.g. `0.42` → `42%`) |
|
|
148
|
+
| `#pct` | no | Value is already 0–100; rendered as `value%` (e.g. `42` → `42%`) |
|
|
149
|
+
| `#units=<currency>` | no | Adds currency symbol and compacts to K/M/B. Accepted values: `usd`, `eur`, `gbp`, `cad`, `aud`, `jpy` |
|
|
150
|
+
| `#timeGrain=<grain>` | yes (from `date_trunc`, `date_bin`, casts) | Controls time axis label format. Values: `year`, `quarter`, `month`, `week`, `day`, `hour`, `minute`, `second` |
|
|
151
|
+
| `#timeOrdinal=<ordinal>` | yes (from `extract`) | Treats values as ordinal positions on a categorical axis. Values: `hour_of_day`, `day_of_month`, `day_of_year`, `week_of_year`, `month_of_year`, `quarter_of_year`, `dow_0s` (0=Sun), `dow_1s` (1=Sun), `dow_1m` (1=Mon) |
|
|
152
|
+
|
|
123
153
|
## `select` statements
|
|
124
154
|
|
|
125
155
|
`select` in GSQL has been extended to leverage join relationships, dimensions, and measures.
|
|
@@ -211,16 +241,16 @@ table orders (
|
|
|
211
241
|
user_id BIGINT
|
|
212
242
|
created_at DATETIME
|
|
213
243
|
status STRING -- One of 'Processing', 'Shipped', 'Complete', 'Cancelled', 'Returned'
|
|
214
|
-
amount FLOAT -- Amount paid by customer
|
|
215
|
-
cost FLOAT -- Cost of materials
|
|
244
|
+
amount FLOAT -- Amount paid by customer #units=usd
|
|
245
|
+
cost FLOAT -- Cost of materials #units=usd
|
|
216
246
|
|
|
217
247
|
join one users on user_id = users.id
|
|
218
248
|
|
|
219
249
|
revenue_recognized: status in ('Processing', 'Shipped', 'Complete')
|
|
220
|
-
revenue: sum(case when revenue_recognized then amount else 0 end)
|
|
221
|
-
cogs: sum(case when revenue_recognized then cost else 0 end)
|
|
222
|
-
profit: revenue - cogs
|
|
223
|
-
profit_margin: profit / revenue
|
|
250
|
+
revenue: sum(case when revenue_recognized then amount else 0 end) #units=usd
|
|
251
|
+
cogs: sum(case when revenue_recognized then cost else 0 end) #units=usd
|
|
252
|
+
profit: revenue - cogs #units=usd
|
|
253
|
+
profit_margin: profit / revenue #ratio
|
|
224
254
|
)
|
|
225
255
|
```
|
|
226
256
|
|
|
@@ -286,7 +316,7 @@ Another way of thinking about this is that measures are "self-aggregating."
|
|
|
286
316
|
- `group by all` is implied if aggregative and scalar expressions are both present in the `select` clause. This means that `group by` can be omitted and the query will still effectively execute the `group by all`.
|
|
287
317
|
- Expressions in `group by` are implicitly selected, so `from orders select avg(amount) group by user_id` will return two columns.
|
|
288
318
|
- `count` is a reserved word. Do not alias your columns as `count`.
|
|
289
|
-
- Inline window functions are supported using ANSI-style `OVER (...)` clauses. Query-level named windows (`WINDOW w AS (...)`)
|
|
319
|
+
- Inline window functions are supported using ANSI-style `OVER (...)` clauses. Query-level named windows (`WINDOW w AS (...)`) are not supported.
|
|
290
320
|
- Percentiles can be computed easily using Graphene's special functions `pXX(col)` (e.g., p50, p975, p9999).
|
|
291
321
|
- Graphene supports almost all functions of the connected data warehouse. Check package.json to see which database you're connected to.
|
|
292
322
|
|
|
@@ -300,16 +330,16 @@ table orders (
|
|
|
300
330
|
user_id BIGINT
|
|
301
331
|
created_at DATETIME
|
|
302
332
|
status STRING -- One of 'Processing', 'Shipped', 'Complete', 'Cancelled', 'Returned'
|
|
303
|
-
amount FLOAT -- Amount paid by customer
|
|
304
|
-
cost FLOAT -- Cost of materials
|
|
333
|
+
amount FLOAT -- Amount paid by customer #units=usd
|
|
334
|
+
cost FLOAT -- Cost of materials #units=usd
|
|
305
335
|
|
|
306
336
|
join one users on user_id = users.id
|
|
307
337
|
|
|
308
338
|
revenue_recognized: status in ('Processing', 'Shipped', 'Complete')
|
|
309
|
-
revenue: sum(case when revenue_recognized then amount else 0 end)
|
|
310
|
-
cogs: sum(case when revenue_recognized then cost else 0 end)
|
|
311
|
-
profit: revenue - cogs
|
|
312
|
-
profit_margin: profit / revenue
|
|
339
|
+
revenue: sum(case when revenue_recognized then amount else 0 end) #units=usd
|
|
340
|
+
cogs: sum(case when revenue_recognized then cost else 0 end) #units=usd
|
|
341
|
+
profit: revenue - cogs #units=usd
|
|
342
|
+
profit_margin: profit / revenue #ratio
|
|
313
343
|
)
|
|
314
344
|
|
|
315
345
|
table users (
|
|
@@ -321,7 +351,7 @@ table users (
|
|
|
321
351
|
join many orders on id = orders.user_id
|
|
322
352
|
join one user_facts on id = user_facts.id
|
|
323
353
|
|
|
324
|
-
ltv: user_facts.ltv
|
|
354
|
+
ltv: user_facts.ltv #units=usd
|
|
325
355
|
lifetime_orders: user_facts.lifetime_orders
|
|
326
356
|
)
|
|
327
357
|
|
|
@@ -358,6 +388,6 @@ We can extend this table to add measures or joins:
|
|
|
358
388
|
extend regional_orders (
|
|
359
389
|
join one regions on region = regions.name
|
|
360
390
|
|
|
361
|
-
avg_order_value: total_revenue / num_orders
|
|
391
|
+
avg_order_value: total_revenue / num_orders #units=usd
|
|
362
392
|
)
|
|
363
393
|
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Modeling GSQL
|
|
2
|
+
|
|
3
|
+
Conventions and patterns for writing production-quality `.gsql` semantic models. Make sure you've read `references/gsql.md` before proceeding.
|
|
4
|
+
|
|
5
|
+
## New table workflow
|
|
6
|
+
|
|
7
|
+
1. Generate a plain `.gsql` file first: `graphene schema {DB.SCHEMA.TABLE} > tables/{snake_case_table_name}.gsql`
|
|
8
|
+
2. Add table and grain descriptions at the top of the file. If given a dbt project, look up the table's definition, lineage, and related metadata so that you have the full picture.
|
|
9
|
+
3. Add join relationships.
|
|
10
|
+
- If no join documentation is provided, make an educated guess from PK/FK names.
|
|
11
|
+
- Use `graphene run <query>` to confirm the join works as expected: keys match, row counts are sane, and there is no fan-out.
|
|
12
|
+
- Model joins from boths sides (ie. add the join to each respective `table` statement)
|
|
13
|
+
|
|
14
|
+
4. Add dimensions and measures **ONLY** if a semantic model to migrate from has been provided.
|
|
15
|
+
- Compile-verify: `npx graphene compile "from TABLE select dimension1, dimension2, measure1, measure2"`
|
|
16
|
+
|
|
17
|
+
5. Add descriptions to columns, dimensions, and measures via comments.
|
|
18
|
+
- Do not add a description if it already obvious from the name. For example, skip `is_debooked_opportunity BOOLEAN -- Whether the opportunity has been debooked`.
|
|
19
|
+
- Use example values for categorical columns: `graphene run "from TABLE select distinct col limit 10"`.
|
|
20
|
+
- Add synonyms, but only if provided. **DO NOT** guess them.
|
|
21
|
+
- Descriptions can be inlined or placed as a block comment on the line above.
|
|
22
|
+
|
|
23
|
+
6. Add GSQL metadata annotations where applicable eg. `#ratio`, `#pct`, `#timeGrain=day`, etc.
|
|
24
|
+
- Use only annotations that Graphene recognizes (see `references/gsql.md`)
|
|
25
|
+
|
|
26
|
+
## File structure
|
|
27
|
+
|
|
28
|
+
Every `.gsql` file follows this section order:
|
|
29
|
+
|
|
30
|
+
```sql
|
|
31
|
+
-- One-sentence description of what this table contains.
|
|
32
|
+
-- Each row is one <entity> (<primary_or_unique_key_col(s)>).
|
|
33
|
+
table DATABASE.SCHEMA.TABLE_NAME (
|
|
34
|
+
|
|
35
|
+
/* Sub-section headers as needed, to group up fields if there are many columns */
|
|
36
|
+
|
|
37
|
+
column_name TYPE -- A description and a #annotation
|
|
38
|
+
|
|
39
|
+
-- OR, descriptions/metadata for a field/dimension/measure can be on the lines above it
|
|
40
|
+
-- as long as there is NOT an empty line separating
|
|
41
|
+
column_name2 TYPE
|
|
42
|
+
|
|
43
|
+
/* Join relationships */
|
|
44
|
+
|
|
45
|
+
join { one | many } [ database.schema. ]table [ as alias ] on key = table_or_alias_name.key
|
|
46
|
+
|
|
47
|
+
/* Dimensions */
|
|
48
|
+
|
|
49
|
+
dim_name: expression #annotationWithoutDescription
|
|
50
|
+
|
|
51
|
+
/* Measures */
|
|
52
|
+
|
|
53
|
+
measure_name: aggregate_expression
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
/* Example queries */ -- Only if correct query usage patterns are not obvious
|
|
57
|
+
|
|
58
|
+
-- Description of query
|
|
59
|
+
select ...
|
|
60
|
+
;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Section headers use `/* Header */` style. Section headers need a full newline following them or GSQL will assume the header is a comment decorator for the object on the line below it.
|
|
64
|
+
|
|
65
|
+
## Compile-verify workflow
|
|
66
|
+
|
|
67
|
+
Always verify after changes. A parse error in any `.gsql` file prevents all tables from loading. If you see "Unknown table" errors everywhere, check for syntax errors in recently modified files.
|
|
68
|
+
|
|
69
|
+
You can syntax check the whole project with `graphene check`.
|
|
70
|
+
|
|
@@ -15,7 +15,6 @@ Here's an example:
|
|
|
15
15
|
| data | GSQL query or table name | true | query name | - |
|
|
16
16
|
| rows | Number of rows to show in the table before paginating results. Use `"rows=all"` to show all rows in the table. | false | number, `all` | `10` |
|
|
17
17
|
| title | Title for the table | false | string | - |
|
|
18
|
-
| subtitle | Subtitle - appears under the title | false | string | - |
|
|
19
18
|
| headerColor | Background color of the header row | false | Hex color code, css color name | - |
|
|
20
19
|
| headerFontColor | Font color of the header row | false | Hex color code, css color name | - |
|
|
21
20
|
| totalRow | Show a total row at the bottom of the table, defaults to sum of all numeric columns | false | `true`, `false` | `false` |
|
|
@@ -27,16 +26,21 @@ Here's an example:
|
|
|
27
26
|
| backgroundColor | Background color of the table | false | Hex color code, css color name | - |
|
|
28
27
|
| sortable | Enable sort for each column - click the column title to sort | false | `true`, `false` | `true` |
|
|
29
28
|
| sort | Column to sort by on initial page load. Sort direction is asc if unspecified. Can only sort by one column using this prop. If you need multi-column sort, use the order by clause in your sql in combination with this prop. | false | 'column name + asc/desc' | - |
|
|
30
|
-
| search | Add a search bar to the top of your table | false | `true`, `false` | `false` |
|
|
31
|
-
| downloadable | Enable download data button below the table on hover | false | `true`, `false` | `true` |
|
|
32
29
|
| formatColumnTitles | Enable auto-formatting of column titles. Turn off to show raw SQL column names | false | `true`, `false` | `true` |
|
|
33
30
|
| wrapTitles | Wrap column titles | false | `true`, `false` | `false` |
|
|
34
31
|
| compact | Enable a more compact table view that allows more content vertically and horizontally | false | `true`, `false` | `false` |
|
|
35
32
|
| link | Makes each row of your table a clickable link. Accepts a column or expression containing the link to use for each row in your table | false | column name, stored expression name, GSQL expression | - |
|
|
36
33
|
| showLinkCol | Whether to show the column supplied to the `link` attribute | false | `true`, `false` | `false` |
|
|
37
|
-
|
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
| emptyMessage | Text to display when the table has no rows or fails to render | false | string | `"Unable to render table"` |
|
|
35
|
+
|
|
36
|
+
### Semantic colors
|
|
37
|
+
|
|
38
|
+
Any color attribute on `<Table>` or `<Column>` (e.g. `headerColor`, `barColor`, `colorScale`) accepts the semantic names `primary`, `positive`, `negative`, and `warning` in addition to hex codes and CSS color names. They resolve to the current theme's colors so they stay consistent if the theme changes.
|
|
39
|
+
|
|
40
|
+
```markdown
|
|
41
|
+
<Column id=growth contentType=colorscale colorScale=positive />
|
|
42
|
+
<Column id=churn contentType=colorscale colorScale=negative />
|
|
43
|
+
```
|
|
40
44
|
|
|
41
45
|
## Groups
|
|
42
46
|
|
|
@@ -45,7 +49,6 @@ Here's an example:
|
|
|
45
49
|
| groupBy | Column or expression to use to create groups. Note that groups are currently limited to a single group column. | false | column name, stored expression name, GSQL expression | - |
|
|
46
50
|
| groupType | How the groups are shown in the table. Can be accordion (expand/collapse) or section (group column values are merged across rows) | false | `accordion`, `section` | `accordion` |
|
|
47
51
|
| subtotals | Whether to show aggregated totals for the groups | false | `true`, `false` | `false` |
|
|
48
|
-
| subtotalFmt | Specify an override format to use in the subtotal row ([see available formats](#value-formatting)). Custom strings or values are unformatted by default. | false | Excel-style format, built-in format | - |
|
|
49
52
|
| groupsOpen | [groupType=accordion] Whether to show the accordions as open on page load | false | `true`, `false` | `true` |
|
|
50
53
|
| accordionRowColor | [groupType=accordion] Background color for the accordion row | false | Hex color code, css color name | - |
|
|
51
54
|
| subtotalRowColor | [groupType=section] Background color for the subtotal row | false | Hex color code, css color name | - |
|
|
@@ -62,8 +65,8 @@ Here's an example:
|
|
|
62
65
|
<Table data=country_summary>
|
|
63
66
|
<Column id=country />
|
|
64
67
|
<Column id=category />
|
|
65
|
-
<Column id=value_usd
|
|
66
|
-
<Column id=yoy title="Y/Y Growth"
|
|
68
|
+
<Column id=value_usd />
|
|
69
|
+
<Column id=yoy title="Y/Y Growth" />
|
|
67
70
|
</Table>
|
|
68
71
|
```
|
|
69
72
|
|
|
@@ -73,11 +76,7 @@ Here's an example:
|
|
|
73
76
|
| title | Override title of column | false | string | column name (formatted) |
|
|
74
77
|
| description | Adds an info icon with description tooltip on hover | false | string | - |
|
|
75
78
|
| align | Align column text | false | `left`, `center`, `right` | `left` |
|
|
76
|
-
|
|
|
77
|
-
| fmtColumn | Column to use to format values in this column. This is used to achieve different value formats by row. The fmtColumn should contain strings of format codes - either Graphene built-in formats or Excel codes. | false | column name | - |
|
|
78
|
-
| totalAgg | Specify an aggregation function to use for the total row. Accepts predefined functions, custom strings or values | false | `sum`, `mean`, `weightedMean`, `median`, `min`, `max`, `count`, `countDistinct`, custom string or value | `sum` |
|
|
79
|
-
| totalFmt | Specify an override format to use in the total row ([see available formats](#value-formatting)). Custom strings or values are unformatted by default. | false | Excel-style format, built-in format | - |
|
|
80
|
-
| weightCol | Column or expression to use as the weight values for weighted mean aggregation. If not specified, a weight of 1 for each value will be used and the result will be the same as the `mean` aggregation. | false | column name, stored expression name, GSQL expression | - |
|
|
79
|
+
| totalAgg | Specify an aggregation function to use for the total row. Accepts predefined functions, custom strings or values | false | `sum`, `mean`, `median`, `min`, `max`, `count`, `countDistinct`, custom string or value | `sum` |
|
|
81
80
|
| wrap | Wrap column text | false | `true`, `false` | `false` |
|
|
82
81
|
| wrapTitle | Wrap column title | false | `true`, `false` | `false` |
|
|
83
82
|
| contentType | Lets you specify how to treat the content within a column. See below for contentType-specific options. | false | `link`, `image`, `delta`, `colorscale`, `html` | - |
|
|
@@ -17,6 +17,8 @@ from users
|
|
|
17
17
|
where email ilike concat('%', $name_of_input, '%')
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
Text input values also sync into the page URL query string so a reload or shared link preserves the same filter state.
|
|
21
|
+
|
|
20
22
|
# Attributes
|
|
21
23
|
|
|
22
24
|
| Attribute | Description | Required | Options | Default |
|
|
@@ -24,5 +26,4 @@ where email ilike concat('%', $name_of_input, '%')
|
|
|
24
26
|
| name | Name of the text input, used to reference the selected value elsewhere as `"$name"` | true | string | - |
|
|
25
27
|
| title | Title displayed above the text input | false | string | - |
|
|
26
28
|
| placeholder | Alternative placeholder text displayed in the text input | false | string | `"Type to search"` |
|
|
27
|
-
| hideDuringPrint | Hide the component when the report is printed | false | `true`, `false` | `true` |
|
|
28
29
|
| description | Adds an info icon with description tooltip on hover | false | string | - |
|