@graphenedata/cli 0.0.4 → 0.0.5
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/cli.ts +7 -43
- package/dist/cli/cli.js +529 -293
- package/dist/docs/graphene.md +924 -63
- package/dist/ui/component-utilities/echarts.js +3 -1
- package/dist/ui/component-utilities/themeStores.ts +35 -7
- package/dist/ui/components/AreaChart.svelte +2 -1
- package/dist/ui/components/BarChart.svelte +2 -1
- package/dist/ui/components/BigValue.svelte +1 -1
- package/dist/ui/components/Chart.svelte +10 -1
- package/dist/ui/components/ECharts.svelte +2 -0
- package/dist/ui/components/LineChart.svelte +2 -1
- package/dist/ui/components/PieChart.svelte +1 -1
- package/dist/ui/components/QueryLoad.svelte +5 -6
- package/dist/ui/components/TableRow.svelte +1 -1
- package/dist/ui/components/_Table.svelte +2 -0
- package/dist/ui/internal/queryEngine.ts +16 -13
- package/dist/ui/internal/telemetry.ts +5 -3
- package/dist/ui/web.js +26 -11
- package/package.json +2 -1
- package/dist/docs/data_apps/components/charts/annotations.md +0 -673
- package/dist/docs/data_apps/components/charts/area-chart.md +0 -202
- package/dist/docs/data_apps/components/charts/bar-chart.md +0 -317
- package/dist/docs/data_apps/components/charts/box-plot.md +0 -190
- package/dist/docs/data_apps/components/charts/bubble-chart.md +0 -151
- package/dist/docs/data_apps/components/charts/calendar-heatmap.md +0 -112
- package/dist/docs/data_apps/components/charts/custom-echarts.md +0 -308
- package/dist/docs/data_apps/components/charts/echarts-options.md +0 -217
- package/dist/docs/data_apps/components/charts/funnel-chart.md +0 -106
- package/dist/docs/data_apps/components/charts/heatmap.md +0 -180
- package/dist/docs/data_apps/components/charts/histogram.md +0 -107
- package/dist/docs/data_apps/components/charts/line-chart.md +0 -265
- package/dist/docs/data_apps/components/charts/mixed-type-charts.md +0 -240
- package/dist/docs/data_apps/components/charts/sankey-diagram.md +0 -301
- package/dist/docs/data_apps/components/charts/scatter-plot.md +0 -134
- package/dist/docs/data_apps/components/charts/sparkline.md +0 -68
- package/dist/docs/data_apps/components/data/big-value.md +0 -153
- package/dist/docs/data_apps/components/data/delta.md +0 -89
- package/dist/docs/data_apps/components/data/table.md +0 -470
- package/dist/docs/data_apps/components/data/value.md +0 -97
- package/dist/docs/data_apps/components/inputs/button-group.md +0 -154
- package/dist/docs/data_apps/components/inputs/checkbox.md +0 -52
- package/dist/docs/data_apps/components/inputs/date-input.md +0 -131
- package/dist/docs/data_apps/components/inputs/date-range.md +0 -124
- package/dist/docs/data_apps/components/inputs/dimension-grid.md +0 -67
- package/dist/docs/data_apps/components/inputs/dropdown.md +0 -199
- package/dist/docs/data_apps/components/inputs/index.md +0 -3
- package/dist/docs/data_apps/components/inputs/slider.md +0 -126
- package/dist/docs/data_apps/components/inputs/text-input.md +0 -86
- package/dist/docs/data_apps/components/maps/area-map.md +0 -397
- package/dist/docs/data_apps/components/maps/base-map.md +0 -269
- package/dist/docs/data_apps/components/maps/bubble-map.md +0 -361
- package/dist/docs/data_apps/components/maps/point-map.md +0 -326
- package/dist/docs/data_apps/components/maps/us-map.md +0 -167
- package/dist/docs/data_apps/components/ui/accordion.md +0 -116
- package/dist/docs/data_apps/components/ui/alert.md +0 -37
- package/dist/docs/data_apps/components/ui/big-link.md +0 -19
- package/dist/docs/data_apps/components/ui/details.md +0 -58
- package/dist/docs/data_apps/components/ui/download-data.md +0 -41
- package/dist/docs/data_apps/components/ui/embed.md +0 -47
- package/dist/docs/data_apps/components/ui/grid.md +0 -45
- package/dist/docs/data_apps/components/ui/image.md +0 -61
- package/dist/docs/data_apps/components/ui/info.md +0 -47
- package/dist/docs/data_apps/components/ui/last-refreshed.md +0 -28
- package/dist/docs/data_apps/components/ui/link-button.md +0 -20
- package/dist/docs/data_apps/components/ui/link.md +0 -40
- package/dist/docs/data_apps/components/ui/modal.md +0 -57
- package/dist/docs/data_apps/components/ui/note.md +0 -32
- package/dist/docs/data_apps/components/ui/print-format-components.md +0 -85
- package/dist/docs/data_apps/components/ui/tabs.md +0 -122
package/dist/docs/graphene.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Graphene documentation
|
|
2
2
|
|
|
3
3
|
Graphene is a framework for data analysis, semantic modeling, and data visualization in code. Graphene projects are comprised of:
|
|
4
4
|
- .gsql files that define semantics-enriched tables (aka semantic models)
|
|
@@ -6,6 +6,80 @@ Graphene is a framework for data analysis, semantic modeling, and data visualiza
|
|
|
6
6
|
|
|
7
7
|
Graphene also has a CLI that lets you check syntax, run queries, serve data apps, and more.
|
|
8
8
|
|
|
9
|
+
**Table of Contents**
|
|
10
|
+
|
|
11
|
+
- [Graphene SQL (GSQL)](#graphene-sql-gsql)
|
|
12
|
+
- [`table` statements](#table-statements)
|
|
13
|
+
- [Base columns (required)](#base-columns-required)
|
|
14
|
+
- [Join relationships](#join-relationships)
|
|
15
|
+
- [Multiple join relationships between the same two tables](#multiple-join-relationships-between-the-same-two-tables)
|
|
16
|
+
- [Best practices for modeling join relationships](#best-practices-for-modeling-join-relationships)
|
|
17
|
+
- [Stored expressions](#stored-expressions)
|
|
18
|
+
- [`select` statements](#select-statements)
|
|
19
|
+
- [Using join relationships in queries](#using-join-relationships-in-queries)
|
|
20
|
+
- [Multi-hop joins](#multi-hop-joins)
|
|
21
|
+
- [Using stored expressions in queries](#using-stored-expressions-in-queries)
|
|
22
|
+
- [Safe aggregation in fan-outs](#safe-aggregation-in-fan-outs)
|
|
23
|
+
- [`table as` statements](#table-as-statements)
|
|
24
|
+
- [Other miscellaneous details about GSQL](#other-miscellaneous-details-about-gsql)
|
|
25
|
+
- [Graphene data apps (dashboards)](#graphene-data-apps-dashboards)
|
|
26
|
+
- [Visualization components](#visualization-components)
|
|
27
|
+
- [Bar chart](#bar-chart)
|
|
28
|
+
- [All bar chart attributes](#all-bar-chart-attributes)
|
|
29
|
+
- [General](#general)
|
|
30
|
+
- [Data](#data)
|
|
31
|
+
- [Formatting & Styling](#formatting--styling)
|
|
32
|
+
- [Value Labels](#value-labels)
|
|
33
|
+
- [Axes](#axes)
|
|
34
|
+
- [Interactivity](#interactivity)
|
|
35
|
+
- [Pie chart](#pie-chart)
|
|
36
|
+
- [All pie chart attributes](#all-pie-chart-attributes)
|
|
37
|
+
- [General](#general-1)
|
|
38
|
+
- [Data](#data-1)
|
|
39
|
+
- [Line chart](#line-chart)
|
|
40
|
+
- [All line chart attributes](#all-line-chart-attributes)
|
|
41
|
+
- [General](#general-2)
|
|
42
|
+
- [Data](#data-2)
|
|
43
|
+
- [Formatting & Styling](#formatting--styling-1)
|
|
44
|
+
- [Axes](#axes-1)
|
|
45
|
+
- [Interactivity](#interactivity-1)
|
|
46
|
+
- [Area chart](#area-chart)
|
|
47
|
+
- [All area chart attributes](#all-area-chart-attributes)
|
|
48
|
+
- [General](#general-3)
|
|
49
|
+
- [Data](#data-3)
|
|
50
|
+
- [Formatting & Styling](#formatting--styling-2)
|
|
51
|
+
- [Value Labels](#value-labels-1)
|
|
52
|
+
- [Axes](#axes-2)
|
|
53
|
+
- [Interactivity](#interactivity-2)
|
|
54
|
+
- [Big value](#big-value)
|
|
55
|
+
- [All big value attributes](#all-big-value-attributes)
|
|
56
|
+
- [Data](#data-4)
|
|
57
|
+
- [Comparison](#comparison)
|
|
58
|
+
- [Sparkline](#sparkline)
|
|
59
|
+
- [Table](#table)
|
|
60
|
+
- [All table attributes](#all-table-attributes)
|
|
61
|
+
- [Table](#table-1)
|
|
62
|
+
- [Groups](#groups)
|
|
63
|
+
- [Column](#column)
|
|
64
|
+
- [Input components](#input-components)
|
|
65
|
+
- [Text input](#text-input)
|
|
66
|
+
- [All text input attributes](#all-text-input-attributes)
|
|
67
|
+
- [Date range](#date-range)
|
|
68
|
+
- [All date range attributes](#all-date-range-attributes)
|
|
69
|
+
- [Dropdown](#dropdown)
|
|
70
|
+
- [All dropdown attributes](#all-dropdown-attributes)
|
|
71
|
+
- [DropdownOption](#dropdownoption)
|
|
72
|
+
- [Other components](#other-components)
|
|
73
|
+
- [Value formatting](#value-formatting)
|
|
74
|
+
- [Built-in Formats](#built-in-formats)
|
|
75
|
+
- [Auto-Formatting](#auto-formatting)
|
|
76
|
+
- [Dates](#dates)
|
|
77
|
+
- [Currencies](#currencies)
|
|
78
|
+
- [Numbers](#numbers)
|
|
79
|
+
- [Percentages](#percentages)
|
|
80
|
+
- [Graphene CLI](#graphene-cli)
|
|
81
|
+
- [AGENT INSTRUCTIONS](#agent-instructions)
|
|
82
|
+
|
|
9
83
|
## Graphene SQL (GSQL)
|
|
10
84
|
|
|
11
85
|
GSQL is comprised of `table` statements that declare tables and `select` statements that query them.
|
|
@@ -109,7 +183,7 @@ A stored expression must be given a name via `as`. It can then be referenced by
|
|
|
109
183
|
|
|
110
184
|
Like expressions in regular SQL, expressions in GSQL are either scalar or aggregative. In BI parlance, these would be called dimensions and measures, respectively.
|
|
111
185
|
|
|
112
|
-
Expressions can refer to other expressions, as
|
|
186
|
+
Expressions can refer to other expressions, as from the example before:
|
|
113
187
|
|
|
114
188
|
```sql
|
|
115
189
|
table orders (
|
|
@@ -145,31 +219,15 @@ If you recall the model from before:
|
|
|
145
219
|
|
|
146
220
|
```sql
|
|
147
221
|
table orders (
|
|
148
|
-
|
|
222
|
+
...
|
|
149
223
|
user_id BIGINT,
|
|
150
|
-
|
|
151
|
-
status STRING, -- One of 'Processing', 'Shipped', 'Complete', 'Cancelled', 'Returned'
|
|
152
|
-
amount FLOAT, -- Amount paid by customer
|
|
153
|
-
cost FLOAT, -- Cost of materials
|
|
154
|
-
|
|
155
|
-
join_one users on user_id = users.id,
|
|
156
|
-
|
|
157
|
-
status in ('Processing', 'Shipped', 'Complete') as revenue_recognized,
|
|
158
|
-
|
|
159
|
-
sum(case when revenue_recognized then amount else 0 end) as revenue,
|
|
160
|
-
sum(case when revenue_recognized then cost else 0 end) as cogs,
|
|
161
|
-
revenue - cogs as profit,
|
|
162
|
-
profit / revenue as profit_margin
|
|
224
|
+
join_one users on user_id = users.id
|
|
163
225
|
)
|
|
164
226
|
|
|
165
227
|
table users (
|
|
166
228
|
id BIGINT primary_key,
|
|
167
229
|
name VARCHAR,
|
|
168
|
-
|
|
169
|
-
age INTEGER,
|
|
170
|
-
country_code VARCHAR,
|
|
171
|
-
|
|
172
|
-
join_many orders on id = orders.user_id
|
|
230
|
+
...
|
|
173
231
|
)
|
|
174
232
|
```
|
|
175
233
|
|
|
@@ -232,7 +290,7 @@ limit 10
|
|
|
232
290
|
|
|
233
291
|
A stored expression can be invoked in a query by simply referencing it by name.
|
|
234
292
|
|
|
235
|
-
Again, using the
|
|
293
|
+
Again, using the orders table from before:
|
|
236
294
|
|
|
237
295
|
```sql
|
|
238
296
|
table orders (
|
|
@@ -252,16 +310,6 @@ table orders (
|
|
|
252
310
|
revenue - cogs as profit,
|
|
253
311
|
profit / revenue as profit_margin
|
|
254
312
|
)
|
|
255
|
-
|
|
256
|
-
table users (
|
|
257
|
-
id BIGINT primary_key,
|
|
258
|
-
name VARCHAR,
|
|
259
|
-
email VARCHAR,
|
|
260
|
-
age INTEGER,
|
|
261
|
-
country_code VARCHAR,
|
|
262
|
-
|
|
263
|
-
join_many orders on id = orders.user_id
|
|
264
|
-
)
|
|
265
313
|
```
|
|
266
314
|
|
|
267
315
|
We can count the number of orders that were revenue-recognized vs. not:
|
|
@@ -402,61 +450,874 @@ table user_facts as (
|
|
|
402
450
|
- `count` is a reserved word. Do not alias your columns as `count`.
|
|
403
451
|
- Window functions and set operations are not supported.
|
|
404
452
|
|
|
405
|
-
## Graphene
|
|
453
|
+
## Graphene data apps (dashboards)
|
|
406
454
|
|
|
407
455
|
Graphene data apps are written in Markdown with the addition of special Graphene HTML components. Markdown files can contain named GSQL queries in code fences that components can then refer to. Those queries can use any tables defined in .gsql files.
|
|
408
456
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
457
|
+
_my_first_dashboard.md_
|
|
458
|
+
````md
|
|
459
|
+
# Order analysis
|
|
460
|
+
|
|
461
|
+
Looking at our order breakdowns.
|
|
412
462
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
463
|
+
```sql orders_by_month
|
|
464
|
+
select
|
|
465
|
+
date_trunc(created_at, month) as month,
|
|
466
|
+
count(*) as num_orders,
|
|
467
|
+
profit
|
|
468
|
+
from orders
|
|
469
|
+
group by month
|
|
470
|
+
```
|
|
416
471
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
472
|
+
<Row>
|
|
473
|
+
<LineChart title="Orders by Month" data=orders_by_month x=month y=num_orders />
|
|
474
|
+
<LineChart title="Profit by Month, USD" data=orders x="date_trunc(created_at, month)" y=profit />
|
|
475
|
+
</Row>
|
|
421
476
|
````
|
|
422
477
|
|
|
423
|
-
|
|
478
|
+
Syntax notes
|
|
479
|
+
- The `data` attribute can also refer directly to modeled GSQL tables instead of code-fenced queries.
|
|
480
|
+
- Attributes that take column references can also take whole GSQL expressions, as shown in the second line chart from the example above.
|
|
481
|
+
- Like in HTML, the string value assigned to an attribute does not need to be wrapped in double quotes if it only contains alphanumeric characters, `-`, `_`, `:`, or `.`.
|
|
424
482
|
|
|
425
483
|
Best practices
|
|
426
484
|
- If you have multiple time series charts, align their x-axes to have the same range and granularity.
|
|
427
485
|
- Use the same color for a given metric if it is used in multiple charts.
|
|
428
486
|
|
|
429
|
-
###
|
|
487
|
+
### Visualization components
|
|
488
|
+
|
|
489
|
+
#### Bar chart
|
|
490
|
+
|
|
491
|
+
Use bar or column charts to compare a metric across categories. Bar charts are best with a small number of categories and series, and should generally start at 0.
|
|
492
|
+
|
|
493
|
+
Here's an example:
|
|
494
|
+
|
|
495
|
+
```markdown
|
|
496
|
+
<BarChart
|
|
497
|
+
title="Sales by Category"
|
|
498
|
+
data=orders_by_category_2021
|
|
499
|
+
x=month
|
|
500
|
+
y=sales
|
|
501
|
+
series=category
|
|
502
|
+
/>
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
##### All bar chart attributes
|
|
506
|
+
|
|
507
|
+
###### General
|
|
508
|
+
|
|
509
|
+
| Attribute | Description | Options | Default |
|
|
510
|
+
|----------|-------------|---------|---------|
|
|
511
|
+
| title | Chart title. Appears at top left of chart. | string | - |
|
|
512
|
+
| subtitle | Chart subtitle. Appears just under title. | string | - |
|
|
513
|
+
| legend | Turns legend on or off. Legend appears at top center of chart. | `true`, `false` | `true` for multiple series |
|
|
514
|
+
| chartAreaHeight | Minimum height of the chart area (excl. header and footer) in pixels. Adjusting the height affects all viewport sizes and may impact the mobile UX. | number | `180` |
|
|
515
|
+
| renderer | Which chart renderer type (canvas or SVG) to use. See ECharts' documentation on renderers. | `canvas`, `svg` | `canvas` |
|
|
516
|
+
| downloadableData | Whether to show the download button to allow users to download the data | `true`, `false` | `true` |
|
|
517
|
+
| downloadableImage | Whether to show the button to allow users to save the chart as an image | `true`, `false` | `true` |
|
|
518
|
+
|
|
519
|
+
###### Data
|
|
520
|
+
|
|
521
|
+
| Attribute | Description | Required | Options | Default |
|
|
522
|
+
|----------|-------------|----------|---------|---------|
|
|
523
|
+
| data | Query name, wrapped in curly braces | true | query name | - |
|
|
524
|
+
| x | Column or expression to use for the x-axis of the chart | false | column name, stored expression name, GSQL expression | First column |
|
|
525
|
+
| y | Column(s) or expression(s) to use for the y-axis of the chart | false | column name, stored expression name, GSQL expression, list of any combination of these | Any non-assigned numeric columns |
|
|
526
|
+
| y2 | Column(s) or expression(s) to include on a secondary y-axis | false | column name, stored expression name, GSQL expression, list of any combination of these | - |
|
|
527
|
+
| y2SeriesType | Chart type to apply to the series on the y2 axis | false | `bar`, `line`, `scatter` | `bar` |
|
|
528
|
+
| series | Column or expression to use as the series (groups) in a multi-series chart | false | column name, stored expression name, GSQL expression | - |
|
|
529
|
+
| sort | Whether to apply default sort to your data. Default sort is x ascending for number and date x-axes, and y descending for category x-axes | false | `true`, `false` | `true` |
|
|
530
|
+
| type | Grouping method to use for multi-series charts | false | `stacked`, `grouped`, `stacked100` | `stacked` |
|
|
531
|
+
| stackName | Name for an individual stack. If separate Bar components are used with different stackNames, the chart will show multiple stacks | false | string | - |
|
|
532
|
+
| emptySet | Sets behaviour for empty datasets. Can throw an error, a warning, or allow empty. When set to 'error', empty datasets will block builds in `build:strict`. Note this only applies to initial page load - empty datasets caused by input component changes (dropdowns, etc.) are allowed. | false | `error`, `warn`, `pass` | `error` |
|
|
533
|
+
| emptyMessage | Text to display when an empty dataset is received - only applies when `emptySet` is 'warn' or 'pass', or when the empty dataset is a result of an input component change (dropdowns, etc.). | false | string | No records |
|
|
534
|
+
|
|
535
|
+
###### Formatting & Styling
|
|
536
|
+
|
|
537
|
+
| Attribute | Description | Options | Default |
|
|
538
|
+
|----------|-------------|---------|---------|
|
|
539
|
+
| xFmt | Format to use for x column ([see available formats](#value-formatting)) | Excel-style format, built-in format name | - |
|
|
540
|
+
| yFmt | Format to use for y column ([see available formats](#value-formatting)) | Excel-style format, built-in format name | - |
|
|
541
|
+
| y2Fmt | Format to use for y2 column(s) ([see available formats](#value-formatting)) | Excel-style format, built-in format name | - |
|
|
542
|
+
| seriesLabelFmt | Format to use for series label ([see available formats](#value-formatting)) | Excel-style format, built-in format name | - |
|
|
543
|
+
| fillColor | Color to override default series color. Only accepts a single color. | CSS name, hexademical, RGB, HSL | - |
|
|
544
|
+
| fillOpacity | % of the full color that should be rendered, with remainder being transparent | number (0 to 1) | `1` |
|
|
545
|
+
| outlineWidth | Width of line surrounding each bar | number | `0` |
|
|
546
|
+
| outlineColor | Color to use for outline if outlineWidth > 0 | CSS name, hexademical, RGB, HSL | - |
|
|
547
|
+
| colorPalette | List of custom colors to use for the chart | list of color strings (CSS name, hexademical, RGB, HSL) e.g. `"#cf0d06, #eb5752, #e88a87"` | built-in color palette |
|
|
548
|
+
| seriesOrder | Apply a specific order to the series in a multi-series chart. | list of series names in the order they should be used in the chart `"Canada, US"` | default order implied by the data |
|
|
549
|
+
| leftPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | number | - |
|
|
550
|
+
| rightPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | number | - |
|
|
551
|
+
| xLabelWrap | Whether to wrap x-axis labels when there is not enough space. Default behaviour is to truncate the labels. | `true`, `false` | `false` |
|
|
552
|
+
|
|
553
|
+
###### Value Labels
|
|
554
|
+
|
|
555
|
+
| Attribute | Description | Options | Default |
|
|
556
|
+
|----------|-------------|---------|---------|
|
|
557
|
+
| labels | Show value labels | `true`, `false` | `false` |
|
|
558
|
+
| stackTotalLabel | If using labels, whether to show a total at the top of stacked bar chart | `true`, `false` | `true` |
|
|
559
|
+
| seriesLabels | If using labels, whether to show series labels | `true`, `false` | `true` |
|
|
560
|
+
| labelSize | Font size of value labels | number | `11` |
|
|
561
|
+
| labelPosition | Where label will appear on your series | `outside`, `inside` | Single Series: `outside`, Stacked: `inside`, Grouped: `outside` |
|
|
562
|
+
| labelColor | Font color of value labels | CSS name, hexademical, RGB, HSL | Automatic based on color contrast of background |
|
|
563
|
+
| labelFmt | Format to use for value labels ([see available formats](#value-formatting)) | Excel-style format, built-in format name | same as y column |
|
|
564
|
+
| yLabelFmt | Format to use for value labels for series on the y axis. Overrides any other formats ([see available formats](#value-formatting)) | Excel-style format, built-in format name | - |
|
|
565
|
+
| y2LabelFmt | Format to use for value labels for series on the y2 axis. Overrides any other formats ([see available formats](#value-formatting)) | Excel-style format, built-in format name | - |
|
|
566
|
+
| showAllLabels | Allow all labels to appear on chart, including overlapping labels | `true`, `false` | `false` |
|
|
567
|
+
|
|
568
|
+
###### Axes
|
|
569
|
+
|
|
570
|
+
| Attribute | Description | Options | Default |
|
|
571
|
+
|----------|-------------|---------|---------|
|
|
572
|
+
| swapXY | Swap the x and y axes to create a horizontal chart | `true`, `false` | `false` |
|
|
573
|
+
| yLog | Whether to use a log scale for the y-axis | `true`, `false` | `false` |
|
|
574
|
+
| yLogBase | Base to use when log scale is enabled | number | `10` |
|
|
575
|
+
| xAxisTitle | Name to show under x-axis. If 'true', formatted column name is used. Only works with swapXY=false | string, `true`, `false` | `false` |
|
|
576
|
+
| yAxisTitle | Name to show beside y-axis. If 'true', formatted column name is used. | string, `true`, `false` | `false` |
|
|
577
|
+
| y2AxisTitle | Name to show beside y2 axis. If 'true', formatted column name is used. | string, `true`, `false` | `false` |
|
|
578
|
+
| xGridlines | Turns on/off gridlines extending from x-axis tick marks (vertical lines when swapXY=false) | `true`, `false` | `false` |
|
|
579
|
+
| yGridlines | Turns on/off gridlines extending from y-axis tick marks (horizontal lines when swapXY=false) | `true`, `false` | `true` |
|
|
580
|
+
| y2Gridlines | Turns on/off gridlines extending from y2-axis tick marks (horizontal lines when swapXY=false) | `true`, `false` | `true` |
|
|
581
|
+
| xAxisLabels | Turns on/off value labels on the x-axis | `true`, `false` | `true` |
|
|
582
|
+
| yAxisLabels | Turns on/off value labels on the y-axis | `true`, `false` | `true` |
|
|
583
|
+
| y2AxisLabels | Turns on/off value labels on the y2-axis | `true`, `false` | `true` |
|
|
584
|
+
| xBaseline | Turns on/off thick axis line (line appears at y=0) | `true`, `false` | `true` |
|
|
585
|
+
| yBaseline | Turns on/off thick axis line (line appears directly alongside the y-axis labels) | `true`, `false` | `false` |
|
|
586
|
+
| y2Baseline | Turns on/off thick axis line (line appears directly alongside the y2-axis labels) | `true`, `false` | `false` |
|
|
587
|
+
| xTickMarks | Turns on/off tick marks for each of the x-axis labels | `true`, `false` | `false` |
|
|
588
|
+
| yTickMarks | Turns on/off tick marks for each of the y-axis labels | `true`, `false` | `false` |
|
|
589
|
+
| y2TickMarks | Turns on/off tick marks for each of the y2-axis labels | `true`, `false` | `false` |
|
|
590
|
+
| yMin | Starting value for the y-axis | number | - |
|
|
591
|
+
| yMax | Maximum value for the y-axis | number | - |
|
|
592
|
+
| yScale | Whether to scale the y-axis to fit your data. `yMin` and `yMax` take precedence over `yScale` | `true`, `false` | `false` |
|
|
593
|
+
| y2Min | Starting value for the y2-axis | number | - |
|
|
594
|
+
| y2Max | Maximum value for the y2-axis | number | - |
|
|
595
|
+
| y2Scale | Whether to scale the y-axis to fit your data. `y2Min` and `y2Max` take precedence over `y2Scale` | `true`, `false` | `false` |
|
|
596
|
+
| yAxisColor | Turns on/off color on the y-axis (turned on by default when secondary y-axis is used). Can also be used to set a specific color | `true`, `false`, color string (CSS name, hexademical, RGB, HSL) | `true` when y2 used; `false` otherwise |
|
|
597
|
+
|
|
598
|
+
###### Interactivity
|
|
599
|
+
|
|
600
|
+
| Attribute | Description | Options |
|
|
601
|
+
|----------|-------------|---------|
|
|
602
|
+
| connectGroup | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected | string |
|
|
603
|
+
|
|
604
|
+
#### Pie chart
|
|
605
|
+
|
|
606
|
+
Use a pie chart to show part-to-whole relationships across categories. Best for a small number of categories where proportions are easy to compare.
|
|
607
|
+
|
|
608
|
+
Here's an example:
|
|
609
|
+
|
|
610
|
+
```markdown
|
|
611
|
+
<PieChart
|
|
612
|
+
title="Sales share by category"
|
|
613
|
+
data=orders_by_category_2021
|
|
614
|
+
category=category
|
|
615
|
+
value=sales
|
|
616
|
+
/>
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
##### All pie chart attributes
|
|
620
|
+
|
|
621
|
+
###### General
|
|
622
|
+
|
|
623
|
+
| Attribute | Description | Options | Default |
|
|
624
|
+
|----------|-------------|---------|---------|
|
|
625
|
+
| title | Chart title. Appears at top left of chart. | string | - |
|
|
626
|
+
| subtitle | Chart subtitle. Appears just under title. | string | - |
|
|
627
|
+
|
|
628
|
+
###### Data
|
|
629
|
+
|
|
630
|
+
| Attribute | Description | Required | Options | Default |
|
|
631
|
+
|------|-------------|----------|---------|---------|
|
|
632
|
+
| data | Query name, wrapped in curly braces | true | query name | - |
|
|
633
|
+
| category | Column or expression to use for slice names | true | column name, stored expression name, GSQL expression | - |
|
|
634
|
+
| value | Column or expression to use for slice values | true | column name, stored expression name, GSQL expression | - |
|
|
635
|
+
|
|
636
|
+
#### Line chart
|
|
637
|
+
|
|
638
|
+
Use line charts to display how one or more metrics vary over time. Line charts are suitable for plotting a large number of data points on the same chart.
|
|
639
|
+
|
|
640
|
+
Here's an example:
|
|
641
|
+
|
|
642
|
+
```markdown
|
|
643
|
+
<LineChart
|
|
644
|
+
title="Monthly Sales"
|
|
645
|
+
subtitle="Includes all categories"
|
|
646
|
+
data=orders_by_month
|
|
647
|
+
x=month
|
|
648
|
+
y=sales_usd0k
|
|
649
|
+
yAxisTitle="Sales per Month"
|
|
650
|
+
/>
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
##### All line chart attributes
|
|
654
|
+
|
|
655
|
+
###### General
|
|
656
|
+
|
|
657
|
+
| Attribute | Description | Required | Options | Default |
|
|
658
|
+
|------|-------------|----------|---------|---------|
|
|
659
|
+
| title | Chart title. Appears at top left of chart. | false | string | - |
|
|
660
|
+
| subtitle | Chart subtitle. Appears just under title. | false | string | - |
|
|
661
|
+
| legend | Turn legend on or off. Legend appears at top center of chart. | false | `true`, `false` | `true` for multiple series |
|
|
662
|
+
| chartAreaHeight | Minimum height of the chart area (excl. header and footer) in pixels. Adjusting the height affects all viewport sizes and may impact the mobile UX. | false | number | `180` |
|
|
663
|
+
| renderer | Which chart renderer type (canvas or SVG) to use. See ECharts' [documentation on renderers](https://echarts.apache.org/handbook/en/best-practices/canvas-vs-svg/). | false | `canvas`, `svg` | `canvas` |
|
|
664
|
+
| downloadableData | Whether to show the download button to allow users to download the data | false | `true`, `false` | `true` |
|
|
665
|
+
| downloadableImage | Whether to show the button to allow users to save the chart as an image | false | `true`, `false` | `true` |
|
|
666
|
+
|
|
667
|
+
###### Data
|
|
668
|
+
|
|
669
|
+
| Attribute | Description | Required | Options | Default |
|
|
670
|
+
|------|-------------|----------|---------|---------|
|
|
671
|
+
| data | Query name, wrapped in curly braces | true | query name | - |
|
|
672
|
+
| x | Column or expression to use for the x-axis of the chart | true | column name, stored expression name, GSQL expression | - |
|
|
673
|
+
| y | Column(s) or expression(s) to use for the y-axis of the chart | true | column name, stored expression name, GSQL expression, list of any combination of these | - |
|
|
674
|
+
| y2 | Column(s) or expression(s) to include on a secondary y-axis | false | column name, stored expression name, GSQL expression, list of any combination of these | - |
|
|
675
|
+
| y2SeriesType | Chart type to apply to the series on the y2 axis | false | `line`, `bar`, `scatter` | `line` |
|
|
676
|
+
| series | Column or expression to use as the series (groups) in a multi-series chart | false | column name, stored expression name, GSQL expression | - |
|
|
677
|
+
| sort | Whether to apply default sort to your data. Default is x ascending for number and date x-axes, and y descending for category x-axes | false | `true`, `false` | `true` |
|
|
678
|
+
| handleMissing | Treatment of missing values in the dataset | false | `gap`, `connect`, `zero` | `gap` |
|
|
679
|
+
| emptySet | Sets behaviour for empty datasets. Can throw an error, a warning, or allow empty. When set to 'error', empty datasets will block builds in `build:strict`. Note this only applies to initial page load - empty datasets caused by input component changes (dropdowns, etc.) are allowed. | false | `error`, `warn`, `pass` | `error` |
|
|
680
|
+
| emptyMessage | Text to display when an empty dataset is received - only applies when `emptySet` is 'warn' or 'pass', or when the empty dataset is a result of an input component change (dropdowns, etc.). | false | string | - |
|
|
681
|
+
|
|
682
|
+
###### Formatting & Styling
|
|
683
|
+
|
|
684
|
+
| Attribute | Description | Required | Options | Default |
|
|
685
|
+
|------|-------------|----------|---------|---------|
|
|
686
|
+
| xFmt | Format to use for x column ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
687
|
+
| yFmt | Format to use for y column(s) ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
688
|
+
| y2Fmt | Format to use for y2 column(s) ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
689
|
+
| seriesLabelFmt | Format to use for series label ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
690
|
+
| step | Specifies whether the chart is displayed as a step line | false | `true`, `false` | `false` |
|
|
691
|
+
| stepPosition | Configures the position of turn points for a step line chart | false | `start`, `middle`, `end` | `end` |
|
|
692
|
+
| lineColor | Color to override default series color. Only accepts a single color | false | CSS name, hexademical, RGB, HSL | - |
|
|
693
|
+
| lineOpacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | `1` |
|
|
694
|
+
| lineType | Options to show breaks in a line (dashed or dotted) | false | `solid`, `dashed`, `dotted` | `solid` |
|
|
695
|
+
| lineWidth | Thickness of line (in pixels) | false | number | `2` |
|
|
696
|
+
| markers | Turn on/off markers (shapes rendered onto the points of a line) | false | `true`, `false` | `false` |
|
|
697
|
+
| markerShape | Shape to use if markers=true | false | `circle`, `emptyCircle`, `rect`, `triangle`, `diamond` | `circle` |
|
|
698
|
+
| markerSize | Size of each shape (in pixels) | false | number | `8` |
|
|
699
|
+
| colorPalette | List of custom colors to use for the chart | false | list of color strings (CSS name, hexademical, RGB, HSL) e.g. `"#cf0d06, #eb5752, #e88a87"` | - |
|
|
700
|
+
| seriesOrder | Apply a specific order to the series in a multi-series chart. | false | list of series names in the order they should be used in the chart `"Canada, US"` | default order implied by the data |
|
|
701
|
+
| labels | Show value labels | false | `true`, `false` | `false` |
|
|
702
|
+
| labelSize | Font size of value labels | false | number | `11` |
|
|
703
|
+
| labelPosition | Where label will appear on your series | false | `above`, `middle`, `below` | `above` |
|
|
704
|
+
| labelColor | Font color of value labels | false | CSS name, hexademical, RGB, HSL | - |
|
|
705
|
+
| labelFmt | Format to use for value labels ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
706
|
+
| yLabelFmt | Format to use for value labels for series on the y axis. Overrides any other formats ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
707
|
+
| y2LabelFmt | Format to use for value labels for series on the y2 axis. Overrides any other formats ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
708
|
+
| showAllLabels | Allow all labels to appear on chart, including overlapping labels | false | `true`, `false` | `false` |
|
|
709
|
+
| leftPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | false | number | - |
|
|
710
|
+
| rightPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | false | number | - |
|
|
711
|
+
| xLabelWrap | Whether to wrap x-axis labels when there is not enough space. Default behaviour is to truncate the labels. | false | `true`, `false` | `false` |
|
|
712
|
+
|
|
713
|
+
###### Axes
|
|
714
|
+
|
|
715
|
+
| Attribute | Description | Required | Options | Default |
|
|
716
|
+
|------|-------------|----------|---------|---------|
|
|
717
|
+
| yLog | Whether to use a log scale for the y-axis | false | `true`, `false` | `false` |
|
|
718
|
+
| yLogBase | Base to use when log scale is enabled | false | number | `10` |
|
|
719
|
+
| xAxisTitle | Name to show under x-axis. If 'true', formatted column name is used. Only works with swapXY=false | false | `true`, `string`, `false` | `false` |
|
|
720
|
+
| yAxisTitle | Name to show beside y-axis. If 'true', formatted column name is used. | false | `true`, `string`, `false` | `false` |
|
|
721
|
+
| y2AxisTitle | Name to show beside y2 axis. If 'true', formatted column name is used. | false | `true`, `string`, `false` | `false` |
|
|
722
|
+
| xGridlines | Turns on/off gridlines extending from x-axis tick marks (vertical lines when swapXY=false) | false | `true`, `false` | `false` |
|
|
723
|
+
| yGridlines | Turns on/off gridlines extending from y-axis tick marks (horizontal lines when swapXY=false) | false | `true`, `false` | `true` |
|
|
724
|
+
| y2Gridlines | Turns on/off gridlines extending from y2-axis tick marks (horizontal lines when swapXY=false) | false | `true`, `false` | `true` |
|
|
725
|
+
| xAxisLabels | Turns on/off value labels on the x-axis | false | `true`, `false` | `true` |
|
|
726
|
+
| yAxisLabels | Turns on/off value labels on the y-axis | false | `true`, `false` | `true` |
|
|
727
|
+
| y2AxisLabels | Turns on/off value labels on the y2-axis | false | `true`, `false` | `true` |
|
|
728
|
+
| xBaseline | Turns on/off thick axis line (line appears at y=0) | false | `true`, `false` | `true` |
|
|
729
|
+
| yBaseline | Turns on/off thick axis line (line appears directly alongside the y-axis labels) | false | `true`, `false` | `false` |
|
|
730
|
+
| y2Baseline | Turns on/off thick axis line (line appears directly alongside the y2-axis labels) | false | `true`, `false` | `false` |
|
|
731
|
+
| xTickMarks | Turns on/off tick marks for each of the x-axis labels | false | `true`, `false` | `false` |
|
|
732
|
+
| yTickMarks | Turns on/off tick marks for each of the y-axis labels | false | `true`, `false` | `false` |
|
|
733
|
+
| y2TickMarks | Turns on/off tick marks for each of the y2-axis labels | false | `true`, `false` | `false` |
|
|
734
|
+
| yMin | Starting value for the y-axis | false | number | - |
|
|
735
|
+
| yMax | Maximum value for the y-axis | false | number | - |
|
|
736
|
+
| yScale | Whether to scale the y-axis to fit your data. `yMin` and `yMax` take precedence over `yScale` | false | `true`, `false` | `false` |
|
|
737
|
+
| y2Min | Starting value for the y2-axis | false | number | - |
|
|
738
|
+
| y2Max | Maximum value for the y2-axis | false | number | - |
|
|
739
|
+
| y2Scale | Whether to scale the y-axis to fit your data. `y2Min` and `y2Max` take precedence over `y2Scale` | false | `true`, `false` | `false` |
|
|
740
|
+
|
|
741
|
+
###### Interactivity
|
|
742
|
+
|
|
743
|
+
| Attribute | Description | Required | Options | Default |
|
|
744
|
+
|------|-------------|----------|---------|---------|
|
|
745
|
+
| connectGroup | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected | false | - | - |
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
#### Area chart
|
|
749
|
+
|
|
750
|
+
Use area charts to track how a metric with multiple series changes over time, or a continuous range. Area charts emphasize changes in the sum of series over the individual series.
|
|
751
|
+
|
|
752
|
+
Here's an example:
|
|
753
|
+
|
|
754
|
+
```markdown
|
|
755
|
+
<AreaChart
|
|
756
|
+
data=orders_by_month
|
|
757
|
+
x=month
|
|
758
|
+
y=sales
|
|
759
|
+
/>
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
##### All area chart attributes
|
|
763
|
+
|
|
764
|
+
###### General
|
|
765
|
+
|
|
766
|
+
| Attribute | Description | Required | Options | Default |
|
|
767
|
+
|------|-------------|----------|---------|---------|
|
|
768
|
+
| title | Chart title. Appears at top left of chart. | false | string | - |
|
|
769
|
+
| subtitle | Chart subtitle. Appears just under title. | false | string | - |
|
|
770
|
+
| legend | Turn legend on or off. Legend appears at top center of chart. | false | `true`, `false` | `true` for multiple series |
|
|
771
|
+
| chartAreaHeight | Minimum height of the chart area (excl. header and footer) in pixels. Adjusting the height affects all viewport sizes and may impact the mobile UX. | false | number | `180` |
|
|
772
|
+
| renderer | Which chart renderer type (canvas or SVG) to use. See ECharts' [documentation on renderers](https://echarts.apache.org/handbook/en/best-practices/canvas-vs-svg/). | false | `canvas`, `svg` | `canvas` |
|
|
773
|
+
| downloadableData | Whether to show the download button to allow users to download the data | false | `true`, `false` | `true` |
|
|
774
|
+
| downloadableImage | Whether to show the button to allow users to save the chart as an image | false | `true`, `false` | `true` |
|
|
775
|
+
|
|
776
|
+
###### Data
|
|
777
|
+
|
|
778
|
+
| Attribute | Description | Required | Options | Default |
|
|
779
|
+
|------|-------------|----------|---------|---------|
|
|
780
|
+
| data | Query name, wrapped in curly braces | true | query name | - |
|
|
781
|
+
| x | Column or expression to use for the x-axis of the chart | true | column name, stored expression name, GSQL expression | First column |
|
|
782
|
+
| y | Column(s) or expression(s) to use for the y-axis of the chart | true | column name, stored expression name, GSQL expression, list of any combination of these | Any non-assigned numeric columns |
|
|
783
|
+
| series | Column or expression to use as the series (groups) in a multi-series chart | false | column name, stored expression name, GSQL expression | - |
|
|
784
|
+
| sort | Whether to apply default sort to your data. Default sort is x ascending for number and date x-axes, and y descending for category x-axes | false | `true`, `false` | `true` |
|
|
785
|
+
| type | Grouping method to use for multi-series charts | false | `stacked`, `stacked100` | `stacked` |
|
|
786
|
+
| handleMissing | Treatment of missing values in the dataset | false | `gap`, `connect`, `zero` | `gap` for single series, `zero` for multi-series |
|
|
787
|
+
| emptySet | Sets behaviour for empty datasets. Can throw an error, a warning, or allow empty. When set to 'error', empty datasets will block builds in `build:strict`. Note this only applies to initial page load - empty datasets caused by input component changes (dropdowns, etc.) are allowed. | false | `error`, `warn`, `pass` | `error` |
|
|
788
|
+
| emptyMessage | Text to display when an empty dataset is received - only applies when `emptySet` is 'warn' or 'pass', or when the empty dataset is a result of an input component change (dropdowns, etc.). | false | string | "No records" |
|
|
789
|
+
|
|
790
|
+
###### Formatting & Styling
|
|
791
|
+
|
|
792
|
+
| Attribute | Description | Required | Options | Default |
|
|
793
|
+
|------|-------------|----------|---------|---------|
|
|
794
|
+
| xFmt | Format to use for x column ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
795
|
+
| yFmt | Format to use for y column ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
796
|
+
| seriesLabelFmt | Format to use for series label ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
797
|
+
| step | Specifies whether the chart is displayed as a step line | false | `true`, `false` | `false` |
|
|
798
|
+
| stepPosition | Configures the position of turn points for a step line chart | false | `start`, `middle`, `end` | `end` |
|
|
799
|
+
| fillColor | Color to override default series color. Only accepts a single color. | false | CSS name, hexademical, RGB, HSL | - |
|
|
800
|
+
| lineColor | Color to override default line color. Only accepts a single color. | false | CSS name, hexademical, RGB, HSL | - |
|
|
801
|
+
| fillOpacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | `0.7` |
|
|
802
|
+
| line | Show line on top of the area | false | `true`, `false` | `true` |
|
|
803
|
+
| colorPalette | List of custom colors to use for the chart | false | list of color strings (CSS name, hexademical, RGB, HSL) e.g. `"#cf0d06, #eb5752, #e88a87"` | built-in color palette |
|
|
804
|
+
| seriesOrder | Apply a specific order to the series in a multi-series chart. | false | list of series names in the order they should be used in the chart `"Canada, US"` | default order implied by the data |
|
|
805
|
+
| leftPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | false | number | - |
|
|
806
|
+
| rightPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | false | number | - |
|
|
807
|
+
| xLabelWrap | Whether to wrap x-axis labels when there is not enough space. Default behaviour is to truncate the labels. | false | `true`, `false` | `false` |
|
|
808
|
+
|
|
809
|
+
###### Value Labels
|
|
810
|
+
|
|
811
|
+
| Attribute | Description | Required | Options | Default |
|
|
812
|
+
|------|-------------|----------|---------|---------|
|
|
813
|
+
| labels | Show value labels | false | `true`, `false` | `false` |
|
|
814
|
+
| labelSize | Font size of value labels | false | number | `11` |
|
|
815
|
+
| labelPosition | Where label will appear on your series | false | `above`, `middle`, `below` | `above` |
|
|
816
|
+
| labelColor | Font color of value labels | false | CSS name, hexademical, RGB, HSL | Automatic based on color contrast of background |
|
|
817
|
+
| labelFmt | Format to use for value labels ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | same as y column |
|
|
818
|
+
| showAllLabels | Allow all labels to appear on chart, including overlapping labels | false | `true`, `false` | `false` |
|
|
819
|
+
|
|
820
|
+
###### Axes
|
|
821
|
+
|
|
822
|
+
| Attribute | Description | Required | Options | Default |
|
|
823
|
+
|------|-------------|----------|---------|---------|
|
|
824
|
+
| yLog | Whether to use a log scale for the y-axis | false | `true`, `false` | `false` |
|
|
825
|
+
| yLogBase | Base to use when log scale is enabled | false | number | `10` |
|
|
826
|
+
| xAxisTitle | Name to show under x-axis. If 'true', formatted column name is used. Only works with swapXY=false | false | `true`, `string`, `false` | `false` |
|
|
827
|
+
| yAxisTitle | Name to show beside y-axis. If 'true', formatted column name is used. | false | `true`, `string`, `false` | `false` |
|
|
828
|
+
| xGridlines | Turns on/off gridlines extending from x-axis tick marks (vertical lines when swapXY=false) | false | `true`, `false` | `false` |
|
|
829
|
+
| yGridlines | Turns on/off gridlines extending from y-axis tick marks (horizontal lines when swapXY=false) | false | `true`, `false` | `true` |
|
|
830
|
+
| xAxisLabels | Turns on/off value labels on the x-axis | false | `true`, `false` | `true` |
|
|
831
|
+
| yAxisLabels | Turns on/off value labels on the y-axis | false | `true`, `false` | `true` |
|
|
832
|
+
| xBaseline | Turns on/off thick axis line (line appears at y=0) | false | `true`, `false` | `true` |
|
|
833
|
+
| yBaseline | Turns on/off thick axis line (line appears directly alongside the y-axis labels) | false | `true`, `false` | `false` |
|
|
834
|
+
| xTickMarks | Turns on/off tick marks for each of the x-axis labels | false | `true`, `false` | `false` |
|
|
835
|
+
| yTickMarks | Turns on/off tick marks for each of the y-axis labels | false | `true`, `false` | `false` |
|
|
836
|
+
| yMin | Starting value for the y-axis | false | number | - |
|
|
837
|
+
| yMax | Maximum value for the y-axis | false | number | - |
|
|
838
|
+
| yScale | Whether to scale the y-axis to fit your data. `yMin` and `yMax` take precedence over `yScale` | false | `true`, `false` | `false` |
|
|
839
|
+
|
|
840
|
+
###### Interactivity
|
|
841
|
+
|
|
842
|
+
| Attribute | Description | Required | Options | Default |
|
|
843
|
+
|------|-------------|----------|---------|---------|
|
|
844
|
+
| connectGroup | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected | false | - | - |
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
#### Big value
|
|
848
|
+
|
|
849
|
+
Use big values to display a large value standalone, and optionally include a comparison and a sparkline.
|
|
850
|
+
|
|
851
|
+
Here's an example:
|
|
852
|
+
|
|
853
|
+
```markdown
|
|
854
|
+
<BigValue
|
|
855
|
+
data=orders_with_comparisons
|
|
856
|
+
value=num_orders
|
|
857
|
+
sparkline=month
|
|
858
|
+
comparison=order_growth
|
|
859
|
+
comparisonFmt=pct1
|
|
860
|
+
comparisonTitle="vs. Last Month"
|
|
861
|
+
/>
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
##### All big value attributes
|
|
865
|
+
|
|
866
|
+
###### Data
|
|
867
|
+
|
|
868
|
+
| Attribute | Description | Required | Options | Default |
|
|
869
|
+
|------|-------------|----------|---------|---------|
|
|
870
|
+
| data | Query name, wrapped in curly braces | true | query name | - |
|
|
871
|
+
| value | Column or expression to pull the main value from. | true | column name, stored expression name, GSQL expression | - |
|
|
872
|
+
| title | Title of the card. | false | string | Title of the value column. |
|
|
873
|
+
| minWidth | Overrides min-width of component | false | % or px value | `"18%"` |
|
|
874
|
+
| maxWidth | Adds a max-width to the component | false | % or px value | - |
|
|
875
|
+
| fmt | Sets format for the value ([see available formats](#value-formatting)) | false | Excel-style format, built-in format | - |
|
|
876
|
+
| emptySet | Sets behaviour for empty datasets. Can throw an error, a warning, or allow empty. When set to 'error', empty datasets will block builds in `build:strict`. Note this only applies to initial page load - empty datasets caused by input component changes (dropdowns, etc.) are allowed. | false | `error`, `warn`, `pass` | `error` |
|
|
877
|
+
| emptyMessage | Text to display when an empty dataset is received - only applies when `emptySet` is 'warn' or 'pass', or when the empty dataset is a result of an input component change (dropdowns, etc.). | false | string | `"No records"` |
|
|
878
|
+
| link | Used to navigate to other pages. Can be a full external link like `"https://google.com"` or an internal link like `"/sales/performance"` | false | - | - |
|
|
879
|
+
|
|
880
|
+
###### Comparison
|
|
881
|
+
|
|
882
|
+
| Attribute | Description | Required | Options | Default |
|
|
883
|
+
|------|-------------|----------|---------|---------|
|
|
884
|
+
| comparison | Column or expression to pull the comparison value from. | false | column name, stored expression name, GSQL expression | - |
|
|
885
|
+
| comparisonTitle | Text to the right of the comparison. | false | string | Title of the comparison column. |
|
|
886
|
+
| comparisonDelta | Whether to display delta symbol and color | false | `true`, `false` | `true` |
|
|
887
|
+
| downIsGood | If present, negative comparison values appear in green, and positive values appear in red. | false | `true`, `false` | `false` |
|
|
888
|
+
| neutralMin | Sets the bottom of the range for 'neutral' values - neutral values appear in grey rather than red or green | false | number | `0` |
|
|
889
|
+
| neutralMax | Sets the top of the range for 'neutral' values - neutral values appear in grey rather than red or green | false | number | `0` |
|
|
890
|
+
| comparisonFmt | Sets format for the comparison ([see available formats](#value-formatting)) | false | Excel-style format, built-in format | - |
|
|
891
|
+
|
|
892
|
+
###### Sparkline
|
|
893
|
+
|
|
894
|
+
| Attribute | Description | Required | Options | Default |
|
|
895
|
+
|------|-------------|----------|---------|---------|
|
|
896
|
+
| sparkline | Column or expression to pull the date from to create the sparkline. | false | column name, stored expression name, GSQL expression | - |
|
|
897
|
+
| sparklineType | Chart type for sparkline | false | `line`, `area`, `bar` | `line` |
|
|
898
|
+
| sparklineValueFmt | Formatting for tooltip values | false | format code | same as fmt if supplied |
|
|
899
|
+
| sparklineDateFmt | Formatting for tooltip dates | false | format code | `YYYY-MM-DD` |
|
|
900
|
+
| sparklineColor | Color of visualization | false | CSS name, hexademical, RGB, HSL | - |
|
|
901
|
+
| sparklineYScale | Whether to truncate the y-axis of the chart to enhance visibility | false | `true`, `false` | `false` |
|
|
902
|
+
| connectGroup | Group name to connect this sparkline to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected | false | string | - |
|
|
903
|
+
| description | Adds an info icon with description tooltip on hover | false | string | - |
|
|
904
|
+
|
|
905
|
+
#### Table
|
|
906
|
+
|
|
907
|
+
Use a Table component to display a richly formatted table of data from a query. Tables are powerful default choice for data display that allow high information density, and are easy to read.
|
|
908
|
+
|
|
909
|
+
Here's an example:
|
|
910
|
+
|
|
911
|
+
```markdown
|
|
912
|
+
<Table data=orders_summary />
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
##### All table attributes
|
|
916
|
+
|
|
917
|
+
###### Table
|
|
918
|
+
|
|
919
|
+
| Attribute | Description | Required | Options | Default |
|
|
920
|
+
|------|-------------|----------|---------|---------|
|
|
921
|
+
| data | Query name, wrapped in curly braces | true | query name | - |
|
|
922
|
+
| 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` |
|
|
923
|
+
| title | Title for the table | false | string | - |
|
|
924
|
+
| subtitle | Subtitle - appears under the title | false | string | - |
|
|
925
|
+
| headerColor | Background color of the header row | false | Hex color code, css color name | - |
|
|
926
|
+
| headerFontColor | Font color of the header row | false | Hex color code, css color name | - |
|
|
927
|
+
| totalRow | Show a total row at the bottom of the table, defaults to sum of all numeric columns | false | `true`, `false` | `false` |
|
|
928
|
+
| totalRowColor | Background color of the total row | false | Hex color code, css color name | - |
|
|
929
|
+
| totalFontColor | Font color of the total row | false | Hex color code, css color name | - |
|
|
930
|
+
| rowNumbers | Turns on or off row index numbers | false | `true`, `false` | `false` |
|
|
931
|
+
| rowLines | Turns on or off borders at the bottom of each row | false | `true`, `false` | `true` |
|
|
932
|
+
| rowShading | Shades every second row in light grey | false | `true`, `false` | `false` |
|
|
933
|
+
| backgroundColor | Background color of the table | false | Hex color code, css color name | - |
|
|
934
|
+
| sortable | Enable sort for each column - click the column title to sort | false | `true`, `false` | `true` |
|
|
935
|
+
| 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' | - |
|
|
936
|
+
| search | Add a search bar to the top of your table | false | `true`, `false` | `false` |
|
|
937
|
+
| downloadable | Enable download data button below the table on hover | false | `true`, `false` | `true` |
|
|
938
|
+
| formatColumnTitles | Enable auto-formatting of column titles. Turn off to show raw SQL column names | false | `true`, `false` | `true` |
|
|
939
|
+
| wrapTitles | Wrap column titles | false | `true`, `false` | `false` |
|
|
940
|
+
| compact | Enable a more compact table view that allows more content vertically and horizontally | false | `true`, `false` | `false` |
|
|
941
|
+
| 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 | - |
|
|
942
|
+
| showLinkCol | Whether to show the column supplied to the `link` attribute | false | `true`, `false` | `false` |
|
|
943
|
+
| generateMarkdown | Helper for writing Table syntax with many columns. When set to true, markdown for the Table including each `Column` contained within the query will be generated and displayed below the table. | false | `true`, `false` | `false` |
|
|
944
|
+
| emptySet | Sets behaviour for empty datasets. Can throw an error, a warning, or allow empty. When set to 'error', empty datasets will block builds in `build:strict`. Note this only applies to initial page load - empty datasets caused by input component changes (dropdowns, etc.) are allowed. | false | `error`, `warn`, `pass` | `error` |
|
|
945
|
+
| emptyMessage | Text to display when an empty dataset is received - only applies when `emptySet` is 'warn' or 'pass', or when the empty dataset is a result of an input component change (dropdowns, etc.). | false | string | "No records" |
|
|
946
|
+
|
|
947
|
+
###### Groups
|
|
948
|
+
|
|
949
|
+
| Attribute | Description | Required | Options | Default |
|
|
950
|
+
|------|-------------|----------|---------|---------|
|
|
951
|
+
| 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 | - |
|
|
952
|
+
| 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` |
|
|
953
|
+
| subtotals | Whether to show aggregated totals for the groups | false | `true`, `false` | `false` |
|
|
954
|
+
| 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 | - |
|
|
955
|
+
| groupsOpen | [groupType=accordion] Whether to show the accordions as open on page load | false | `true`, `false` | `true` |
|
|
956
|
+
| accordionRowColor | [groupType=accordion] Background color for the accordion row | false | Hex color code, css color name | - |
|
|
957
|
+
| subtotalRowColor | [groupType=section] Background color for the subtotal row | false | Hex color code, css color name | - |
|
|
958
|
+
| subtotalFontColor | [groupType=section] Font color for the subtotal row | false | Hex color code, css color name | - |
|
|
959
|
+
| groupNamePosition | [groupType=section] Where the group label will appear in its cell | false | `top`, `middle`, `bottom` | `middle` |
|
|
960
|
+
|
|
961
|
+
###### Column
|
|
962
|
+
|
|
963
|
+
Use the Column sub-component to choose specific columns to display in your table, and to apply options to specific columns. If you don't supply any columns to the table, it will display all columns from your query result.
|
|
964
|
+
|
|
965
|
+
Here's an example:
|
|
966
|
+
|
|
967
|
+
```markdown
|
|
968
|
+
<Table data=country_summary>
|
|
969
|
+
<Column id=country />
|
|
970
|
+
<Column id=category />
|
|
971
|
+
<Column id=value_usd fmt=eur />
|
|
972
|
+
<Column id=yoy title="Y/Y Growth" fmt=pct3 />
|
|
973
|
+
</Table>
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
| Attribute | Description | Required | Options | Default |
|
|
977
|
+
|------|-------------|----------|---------|---------|
|
|
978
|
+
| id | Column id (from SQL query) | true | column name | - |
|
|
979
|
+
| title | Override title of column | false | string | column name (formatted) |
|
|
980
|
+
| description | Adds an info icon with description tooltip on hover | false | string | - |
|
|
981
|
+
| align | Align column text | false | `left`, `center`, `right` | `left` |
|
|
982
|
+
| fmt | Format the values in the column ([see available formats](#value-formatting)) | false | Excel-style format, built-in format | - |
|
|
983
|
+
| 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 | - |
|
|
984
|
+
| 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` |
|
|
985
|
+
| 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 | - |
|
|
986
|
+
| 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 | - |
|
|
987
|
+
| wrap | Wrap column text | false | `true`, `false` | `false` |
|
|
988
|
+
| wrapTitle | Wrap column title | false | `true`, `false` | `false` |
|
|
989
|
+
| contentType | Lets you specify how to treat the content within a column. See below for contentType-specific options. | false | `link`, `image`, `delta`, `colorscale`, `html` | - |
|
|
990
|
+
| colGroup | Group name to display above a group of columns. Columns with the same group name will get a shared header above them | false | string | - |
|
|
991
|
+
| redNegatives | Conditionally sets the font color to red based on whether the selected value is less than 0 | false | `true`, `false` | `false` |
|
|
992
|
+
|
|
993
|
+
Column attributes for specific contentTypes:
|
|
994
|
+
|
|
995
|
+
Images (`contentType=image`)
|
|
996
|
+
|
|
997
|
+
| Attribute | Description | Required | Options | Default |
|
|
998
|
+
|------|-------------|----------|---------|---------|
|
|
999
|
+
| height | Height of image in pixels | false | number | original height of image |
|
|
1000
|
+
| width | Width of image in pixels | false | number | original width of image |
|
|
1001
|
+
| alt | Alt text for image | false | column name | Name of the image file (excluding the file extension) |
|
|
1002
|
+
|
|
1003
|
+
Links (`contentType=link`)
|
|
1004
|
+
|
|
1005
|
+
| Attribute | Description | Required | Options | Default |
|
|
1006
|
+
|------|-------------|----------|---------|---------|
|
|
1007
|
+
| linkLabel | Text to display for link | false | column name, string | raw url |
|
|
1008
|
+
| openInNewTab | Whether to open link in new tab | false | `true`, `false` | `false` |
|
|
1009
|
+
|
|
1010
|
+
Deltas (`contentType=delta`)
|
|
1011
|
+
|
|
1012
|
+
| Attribute | Description | Required | Options | Default |
|
|
1013
|
+
|------|-------------|----------|---------|---------|
|
|
1014
|
+
| deltaSymbol | Whether to show the up/down delta arrow symbol | false | `true`, `false` | `true` |
|
|
1015
|
+
| downIsGood | If present, negative comparison values appear in green, and positive values appear in red. | false | `true`, `false` | `false` |
|
|
1016
|
+
| showValue | Whether to show the delta value. Set this to false to show only the delta arrow indicator. | false | `true`, `false` | `true` |
|
|
1017
|
+
| neutralMin | Start of the range for 'neutral' values, which appear in grey font with a dash instead of an up/down arrow. By default, neutral is not applied to any values. | false | number | `0` |
|
|
1018
|
+
| neutralMax | End of the range for 'neutral' values, which appear in grey font with a dash instead of an up/down arrow. By default, neutral is not applied to any values. | false | number | `0` |
|
|
1019
|
+
| chip | Whether to display the delta as a 'chip', with a background color and border. | false | `true`, `false` | `false` |
|
|
1020
|
+
|
|
1021
|
+
Sparklines (`contentType=sparkline` | `contentType=sparkarea` | `contentType=sparkbar`)
|
|
1022
|
+
|
|
1023
|
+
| Attribute | Description | Required | Options | Default |
|
|
1024
|
+
|------|-------------|----------|---------|---------|
|
|
1025
|
+
| sparkX | Column within an array cell to use as the x-axis for the spark viz. Arrays can be created inside a query using the `"array_agg()"` function from DuckDB | false | column from array cell | - |
|
|
1026
|
+
| sparkY | Column within an array cell to use as the y-axis for the spark viz. Arrays can be created inside a query using the `"array_agg()"` function from DuckDB | false | column from array cell | - |
|
|
1027
|
+
| sparkYScale | Whether to truncate the y-axis | false | `true`, `false` | `false` |
|
|
1028
|
+
| sparkHeight | Height of the spark viz. Making the viz taller will increase the height of the full table row | false | number | `18` |
|
|
1029
|
+
| sparkWidth | Width of the spark viz | false | number | `90` |
|
|
1030
|
+
| sparkColor | Color of the spark viz | false | Hex color code, css color name | - |
|
|
1031
|
+
|
|
1032
|
+
Bar chart column (`contentType=bar`)
|
|
1033
|
+
|
|
1034
|
+
| Attribute | Description | Required | Options | Default |
|
|
1035
|
+
|------|-------------|----------|---------|---------|
|
|
1036
|
+
| barColor | Color of the bars. Affects positive bars only. See `negativeBarColor` to change color of negative bars | false | Hex color code, css color name | - |
|
|
1037
|
+
| negativeBarColor | Color of negative bars | false | Hex color code, css color name | - |
|
|
1038
|
+
| hideLabels | Whether to hide the data labels on the bars | false | `true`, `false` | `false` |
|
|
1039
|
+
| backgroundColor | Background color for bar chart | false | Hex color code, css color name | `transparent` |
|
|
1040
|
+
|
|
1041
|
+
Conditional formatting (`contentType=colorscale`)
|
|
1042
|
+
|
|
1043
|
+
| Attribute | Description | Required | Options | Default |
|
|
1044
|
+
|------|-------------|----------|---------|---------|
|
|
1045
|
+
| colorScale | Color to use for the scale | false | - | `green` |
|
|
1046
|
+
| colorMin | Set a minimum for the scale. Any values below that minimum will appear in the lowest color on the scale | false | number | min of column |
|
|
1047
|
+
| colorMid | Set a midpoint for the scale | false | number | mid of column |
|
|
1048
|
+
| colorMax | Set a maximum for the scale. Any values above that maximum will appear in the highest color on the scale | false | number | max of column |
|
|
1049
|
+
| colorBreakpoints | List of numbers to use as breakpoints for each color in your color scale. Should line up with the colors you provide in `colorScale` | false | list of numbers | - |
|
|
1050
|
+
| scaleColumn | Column or expression to use to define the color scale range. Values in this column will have their cell color determined by the value in the scaleColumn | false | column name, stored expression name, GSQL expression | - |
|
|
1051
|
+
|
|
1052
|
+
### Input components
|
|
1053
|
+
|
|
1054
|
+
#### Text input
|
|
1055
|
+
|
|
1056
|
+
Creates a text input that can be used to filter or search. To see how to filter a query using a text input, see Filters.
|
|
1057
|
+
|
|
1058
|
+
Here's an example:
|
|
1059
|
+
|
|
1060
|
+
```markdown
|
|
1061
|
+
<TextInput
|
|
1062
|
+
name=name_of_input
|
|
1063
|
+
title=Search
|
|
1064
|
+
/>
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
The user-inputted text would then be referenced in GSQL via `$name_of_input`. For example:
|
|
1068
|
+
|
|
1069
|
+
```sql
|
|
1070
|
+
select *
|
|
1071
|
+
from users
|
|
1072
|
+
where email ilike concat('%', $name_of_input, '%')
|
|
1073
|
+
```
|
|
1074
|
+
|
|
1075
|
+
##### All text input attributes
|
|
1076
|
+
|
|
1077
|
+
| Attribute | Description | Required | Options | Default |
|
|
1078
|
+
|------|-------------|----------|---------|---------|
|
|
1079
|
+
| name | Name of the text input, used to reference the selected value elsewhere as `"$name"` | true | string | - |
|
|
1080
|
+
| title | Title displayed above the text input | false | string | - |
|
|
1081
|
+
| placeholder | Alternative placeholder text displayed in the text input | false | string | `"Type to search"` |
|
|
1082
|
+
| hideDuringPrint | Hide the component when the report is printed | false | `true`, `false` | `true` |
|
|
1083
|
+
| description | Adds an info icon with description tooltip on hover | false | string | - |
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
#### Date range
|
|
1087
|
+
|
|
1088
|
+
Creates a date picker that can be used to filter a query. Includes a set of preset ranges for quick selection of common date ranges (relative to the supplied end date). To see how to filter a query using an input component, see Filters.
|
|
1089
|
+
|
|
1090
|
+
Here's an example:
|
|
1091
|
+
|
|
1092
|
+
```markdown
|
|
1093
|
+
<DateRange
|
|
1094
|
+
name=date_range_name
|
|
1095
|
+
data=orders_by_day
|
|
1096
|
+
dates=day
|
|
1097
|
+
/>
|
|
1098
|
+
```
|
|
1099
|
+
|
|
1100
|
+
The start and end dates for the user-selected range would then be referenced in GSQL as `$date_range_name_start` and `$date_range_name_end` at the end. For example:
|
|
1101
|
+
|
|
1102
|
+
```sql
|
|
1103
|
+
select *
|
|
1104
|
+
from orders
|
|
1105
|
+
where created_at > $date_range_name_start and < $date_range_name_end
|
|
1106
|
+
```
|
|
1107
|
+
|
|
1108
|
+
##### All date range attributes
|
|
1109
|
+
|
|
1110
|
+
| Attribute | Description | Required | Options | Default |
|
|
1111
|
+
|------|-------------|----------|---------|---------|
|
|
1112
|
+
| name | Name of the DateRange, used to reference the selected values elsewhere as `"$name_start"` or `"$name_end"` | true | string | - |
|
|
1113
|
+
| data | Query name, wrapped in curly braces | false | query name | - |
|
|
1114
|
+
| dates | Column or expression from the query containing date range to span | false | column name, stored expression name, GSQL expression | - |
|
|
1115
|
+
| start | A manually specified start date to use for the range | false | string formatted YYYY-MM-DD | - |
|
|
1116
|
+
| end | A manually specified end date to use for the range | false | string formatted YYYY-MM-DD | - |
|
|
1117
|
+
| title | Title to display in the Date Range component | false | string | - |
|
|
1118
|
+
| presetRanges | Customize "Select a Range" drop down, by including preset range options | false | list of values e.g. `"Last 7 Days, Last 30 Days"`. Allowed values: `Last 7 Days`, `Last 30 Days`, `Last 90 Days`, `Last 365 Days`, `Last 3 Months`, `Last 6 Months`, `Last 12 Months`, `Last Month`, `Last Year`, `Month to Date`, `Month to Today`, `Year to Date`, `Year to Today`, `All Time` | - |
|
|
1119
|
+
| defaultValue | Accepts preset in string format to apply default value in Date Range picker | false | `"Last 7 Days"`, `"Last 30 Days"`, `"Last 90 Days"`, `"Last 365 Days"`, `"Last 3 Months"`, `"Last 6 Months"`, `"Last 12 Months"`, `"Last Month"`, `"Last Year"`, `"Month to Date"`, `"Month to Today"`, `"Year to Date"`, `"Year to Today"`, `"All Time"` | - |
|
|
1120
|
+
| hideDuringPrint | Hide the component when the report is printed | false | `true`, `false` | `true` |
|
|
1121
|
+
| description | Adds an info icon with description tooltip on hover | false | string | - |
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
#### Dropdown
|
|
1125
|
+
|
|
1126
|
+
Creates a dropdown menu with a list of options that can be selected. The selected option can be used to filter queries or in markdown. To see how to filter a query using a dropdown, see Filters.
|
|
1127
|
+
|
|
1128
|
+
Here's an example:
|
|
1129
|
+
|
|
1130
|
+
````markdown
|
|
1131
|
+
```sql statuses
|
|
1132
|
+
select distinct status from orders
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
<Dropdown
|
|
1136
|
+
title="Select Order Status"
|
|
1137
|
+
name="status_dropdown"
|
|
1138
|
+
data="statuses"
|
|
1139
|
+
value="status"
|
|
1140
|
+
defaultValue="Complete"
|
|
1141
|
+
/>
|
|
1142
|
+
````
|
|
1143
|
+
|
|
1144
|
+
The user-selected value would then be referenced in GSQL as `$status_dropdown`. For example:
|
|
1145
|
+
|
|
1146
|
+
```sql
|
|
1147
|
+
select *
|
|
1148
|
+
from orders
|
|
1149
|
+
where status = $status_dropdown
|
|
1150
|
+
```
|
|
1151
|
+
|
|
1152
|
+
##### All dropdown attributes
|
|
1153
|
+
|
|
1154
|
+
| Attribute | Description | Required | Options | Default |
|
|
1155
|
+
|------|-------------|----------|---------|---------|
|
|
1156
|
+
| name | Name of the dropdown, used to reference the selected value elsewhere as `"$name"` | true | - | - |
|
|
1157
|
+
| data | Query name, wrapped in curly braces | false | query name | - |
|
|
1158
|
+
| value | Column name from the query containing values to pick from | false | column name | - |
|
|
1159
|
+
| multiple | Enables multi-select which returns a list | false | `true`, `false` | `false` |
|
|
1160
|
+
| defaultValue | Value to use when the dropdown is first loaded. Must be one of the options in the dropdown. Lists supported for multi-select. | false | value from dropdown, list of values e.g. `"Value 1, Value 2"` | - |
|
|
1161
|
+
| selectAllByDefault | Selects and returns all values, multiple attribute required | false | `true`, `false` | `false` |
|
|
1162
|
+
| noDefault | Stops any default from being selected. Overrides any set `defaultValue`. | false | boolean | `false` |
|
|
1163
|
+
| disableSelectAll | Removes the `"Select all"` button. Recommended for large datasets. | false | boolean | `false` |
|
|
1164
|
+
| label | Column name from the query containing labels to display instead of the values (e.g., you may want to have the drop-down use `customer_id` as the value, but show `customer_name` to your users) | false | column name | Uses the column in value |
|
|
1165
|
+
| title | Title to display above the dropdown | false | string | - |
|
|
1166
|
+
| order | Column to sort options by, with optional ordering keyword | false | column name [ `asc`, `desc` ] | Ascending based on dropdown value (or label, if specified) |
|
|
1167
|
+
| where | SQL where fragment to filter options by (e.g., where sales > 40000) | false | SQL where clause | - |
|
|
1168
|
+
| hideDuringPrint | Hide the component when the report is printed | false | `true`, `false` | `true` |
|
|
1169
|
+
| description | Adds an info icon with description tooltip on hover | false | string | - |
|
|
1170
|
+
|
|
1171
|
+
###### DropdownOption
|
|
1172
|
+
|
|
1173
|
+
The `DropdownOption` sub-component can be used to manually add options to a dropdown. This is useful to add a default option, or to add options that are not in a query.
|
|
1174
|
+
|
|
1175
|
+
Here's an example:
|
|
1176
|
+
|
|
1177
|
+
```markdown
|
|
1178
|
+
<Dropdown name=hardcoded>
|
|
1179
|
+
<DropdownOption valueLabel="Option One" value=1 />
|
|
1180
|
+
<DropdownOption valueLabel="Option Two" value=2 />
|
|
1181
|
+
<DropdownOption valueLabel="Option Three" value=3 />
|
|
1182
|
+
</Dropdown>
|
|
1183
|
+
```
|
|
1184
|
+
|
|
1185
|
+
| Attribute | Description | Required | Options | Default |
|
|
1186
|
+
|------|-------------|----------|---------|---------|
|
|
1187
|
+
| value | Value to use when the option is selected | true | - | - |
|
|
1188
|
+
| valueLabel | Label to display for the option in the dropdown | false | - | Uses the value |
|
|
1189
|
+
|
|
1190
|
+
### Other components
|
|
1191
|
+
|
|
1192
|
+
`<Row></Row>` - Evenly distributes components inside along the same row.
|
|
1193
|
+
|
|
1194
|
+
### Value formatting
|
|
1195
|
+
|
|
1196
|
+
The easiest way to format numbers and dates in Graphene is through component attributes. You can pass in either of the following:
|
|
1197
|
+
|
|
1198
|
+
* [Excel-style format codes](https://support.microsoft.com/en-us/office/number-format-codes-in-excel-for-mac-5026bbd6-04bc-48cd-bf33-80f18b4eae68) (e.g., `fmt="$#,##0.0"`)
|
|
1199
|
+
* [Graphene's built-in formats](#built-in-formats) (e.g., `fmt=usd2k`)
|
|
1200
|
+
|
|
1201
|
+
For example, you can use the `fmt` attribute to format values inside a BigValue component:
|
|
1202
|
+
|
|
1203
|
+
```markdown
|
|
1204
|
+
<BigValue
|
|
1205
|
+
data=sales_data
|
|
1206
|
+
value=sales
|
|
1207
|
+
fmt="$#,##0"
|
|
1208
|
+
/>
|
|
1209
|
+
```
|
|
1210
|
+
|
|
1211
|
+
Within charts, you can format individual columns using `xFmt` and `yFmt`:
|
|
1212
|
+
|
|
1213
|
+
```markdown
|
|
1214
|
+
<LineChart
|
|
1215
|
+
data=sales_data
|
|
1216
|
+
x=date
|
|
1217
|
+
y=sales
|
|
1218
|
+
xFmt="m/d"
|
|
1219
|
+
yFmt=eur
|
|
1220
|
+
/>
|
|
1221
|
+
```
|
|
1222
|
+
|
|
1223
|
+
In the example above, `xFmt` is passing in an Excel-style code to format the dates and `yFmt` is referencing a built-in format (see the full list of supported formats below).
|
|
1224
|
+
|
|
1225
|
+
**Date formatting**
|
|
1226
|
+
|
|
1227
|
+
Formatting does not apply to the date axis of a chart. For example, if you set `xFmt` to `"m/d/yy"`, you will only see that formatting reflected in your chart tooltips and annotations. This is to ensure that the chart axis labels have the correct spacing.
|
|
1228
|
+
|
|
1229
|
+
#### Built-in Formats
|
|
1230
|
+
|
|
1231
|
+
Graphene supports a variety of date/time, number, percentage, and currency formats.
|
|
1232
|
+
|
|
1233
|
+
##### Auto-Formatting
|
|
1234
|
+
|
|
1235
|
+
Wherever you see `auto` listed beside a format, that means Graphene will automatically format your value based on the context it is in.
|
|
1236
|
+
|
|
1237
|
+
For example, Graphene automatically formats large numbers into shortened versions based on the size of the median number in a column (e.g., 4,000,000 → 4M).
|
|
1238
|
+
|
|
1239
|
+
You can choose to handle these numbers differently by choosing a specific format code. For example, if Graphene is formatting a column as millions, but you want to see all numbers in thousands, you could use the `num0k` format, which will show all numbers in the column in thousands with 0 decimal places.
|
|
1240
|
+
|
|
1241
|
+
##### Dates
|
|
1242
|
+
|
|
1243
|
+
Graphene supports the following date formats:
|
|
1244
|
+
|
|
1245
|
+
* `ddd` - Short day name (e.g., Mon, Tue)
|
|
1246
|
+
* `dddd` - Full day name (e.g., Monday, Tuesday)
|
|
1247
|
+
* `mmm` - Short month name (e.g., Jan, Feb)
|
|
1248
|
+
* `mmmm` - Full month name (e.g., January, February)
|
|
1249
|
+
* `yyyy` - Four-digit year
|
|
1250
|
+
* `shortdate` - Short date format (e.g., Jan 9/22)
|
|
1251
|
+
* `longdate` - Long date format (e.g., January 9, 2022)
|
|
1252
|
+
* `fulldate` - Full date format (e.g., Monday January 9, 2022)
|
|
1253
|
+
* `mdy` - Month/day/year (e.g., 1/9/22)
|
|
1254
|
+
* `dmy` - Day/month/year (e.g., 9/1/22)
|
|
1255
|
+
* `hms` - Time format (e.g., 11:45:03 AM)
|
|
1256
|
+
|
|
1257
|
+
##### Currencies
|
|
1258
|
+
|
|
1259
|
+
Supported currencies include USD, AUD, BRL, CAD, CNY, EUR, GBP, JPY, INR, KRW, NGN, RUB, and SEK.
|
|
1260
|
+
|
|
1261
|
+
In order to use currency tags, use the currency code, optionally appended with:
|
|
1262
|
+
|
|
1263
|
+
* a number indicating the number of decimal places to show (0-2)
|
|
1264
|
+
* a letter indicating the order of magnitude to show ("","k", "m", "b")
|
|
1265
|
+
|
|
1266
|
+
For example, the available tags for USD are:
|
|
1267
|
+
|
|
1268
|
+
* `usd` (auto) - Automatically formats based on value size
|
|
1269
|
+
* `usd0`, `usd1`, `usd2` - USD with 0, 1, or 2 decimal places
|
|
1270
|
+
* `usd0k`, `usd1k`, `usd2k` - USD in thousands (e.g., $64k)
|
|
1271
|
+
* `usd0m`, `usd1m`, `usd2m` - USD in millions (e.g., $42M)
|
|
1272
|
+
* `usd0b`, `usd1b`, `usd2b` - USD in billions (e.g., $1B)
|
|
1273
|
+
|
|
1274
|
+
Similar patterns apply to other supported currencies.
|
|
1275
|
+
|
|
1276
|
+
##### Numbers
|
|
1277
|
+
|
|
1278
|
+
The default number format (when no `fmt` is specified) automatically handles decimal places and summary units (in the same way that `usd` does for currency).
|
|
1279
|
+
|
|
1280
|
+
Available number formats:
|
|
1281
|
+
|
|
1282
|
+
* `num0`, `num1`, `num2`, `num3`, `num4` - Numbers with 0-4 decimal places
|
|
1283
|
+
* `num0k`, `num1k`, `num2k` - Numbers in thousands (e.g., 64k)
|
|
1284
|
+
* `num0m`, `num1m`, `num2m` - Numbers in millions (e.g., 42M)
|
|
1285
|
+
* `num0b`, `num1b`, `num2b` - Numbers in billions (e.g., 1B)
|
|
1286
|
+
* `id` - Integer format for IDs
|
|
1287
|
+
* `fract` - Fraction format
|
|
1288
|
+
* `mult`, `mult0`, `mult1`, `mult2` - Multiplier format (e.g., 5.32x)
|
|
1289
|
+
* `sci` - Scientific notation
|
|
1290
|
+
|
|
1291
|
+
##### Percentages
|
|
1292
|
+
|
|
1293
|
+
Available percentage formats:
|
|
430
1294
|
|
|
431
|
-
|
|
432
|
-
-
|
|
433
|
-
-
|
|
434
|
-
-
|
|
435
|
-
|
|
436
|
-
- Row - evenly distributes its children in a row
|
|
437
|
-
- [DateRange](./data_apps/components/inputs/date-range.md)
|
|
438
|
-
- [BigValue](./data_apps/components/data/big-value.md)
|
|
439
|
-
- [Table](./data_apps/components/data/table.md)
|
|
440
|
-
- [TextInput](./data_apps/components/inputs/text-input.md)
|
|
1295
|
+
* `pct` (auto) - Automatically formats percentages based on value
|
|
1296
|
+
* `pct0` - Percentage with 0 decimal places (e.g., 73%)
|
|
1297
|
+
* `pct1` - Percentage with 1 decimal place (e.g., 73.1%)
|
|
1298
|
+
* `pct2` - Percentage with 2 decimal places (e.g., 73.10%)
|
|
1299
|
+
* `pct3` - Percentage with 3 decimal places (e.g., 73.100%)
|
|
441
1300
|
|
|
442
|
-
##
|
|
1301
|
+
## Graphene CLI
|
|
443
1302
|
|
|
444
1303
|
These are the available commands:
|
|
445
|
-
- `npm run graphene check` - Checks the syntax for the entire Graphene project.
|
|
1304
|
+
- `npm run graphene check` - Checks the syntax (GSQL and Markdown) for the entire Graphene project.
|
|
1305
|
+
- `npm run graphene check <mdPath>` - Checks the syntax for a specified Graphene markdown file. Will also do a runtime check if the dev server is running, and if successful, take a full page screenshot to a temp directory for the agent to view.
|
|
1306
|
+
- `npm run graphene check <mdPath> --chart "<chartTitle>"` - Same as above, except if the runtime check is successful, only takes a screenshot of the specified chart. `<chartTitle>` must match (case sensitive) the `title` attribute on the chart component. `-c` can be used as shorthand for `--chart`.
|
|
446
1307
|
- `npm run graphene compile "<GSQL>"` - Shows how GSQL is translated into the underlying database SQL.
|
|
447
1308
|
- `npm run graphene run "<GSQL>"` - Runs a GSQL query. The tables and semantics defined in all .gsql files in the project are available for the query to use.
|
|
448
1309
|
- `npm run graphene serve` - Starts (or restarts) the dev server, which allows the user to view their Graphene app on localhost.
|
|
449
|
-
- `npm run graphene
|
|
1310
|
+
- `npm run graphene stop` - Stops the dev server.
|
|
450
1311
|
|
|
451
|
-
|
|
1312
|
+
# AGENT INSTRUCTIONS
|
|
452
1313
|
|
|
453
1314
|
Follow these guidelines when working in a Graphene project.
|
|
454
1315
|
- When formulating GSQL queries:
|
|
455
1316
|
- First check all available stored expressions to see if there are any you can use. DO NOT redefine important business definitions like `profit` if they've already been modeled!
|
|
456
1317
|
- Run your GSQL queries in the CLI first, _before_ you write them to a file. This way you can reason about the results to make sure they make sense.
|
|
457
|
-
- Do not try to search the web for Graphene-specific info; you will not find anything. All the documentation is in
|
|
1318
|
+
- Do not try to search the web for Graphene-specific info; you will not find anything. All the documentation is here in graphene.md.
|
|
458
1319
|
- When writing to a .gsql file, check your code with `npm run graphene check`.
|
|
459
1320
|
- When writing to a Graphene .md file:
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
1321
|
+
- Always check your code with `npm run graphene check <mdPath>`.
|
|
1322
|
+
- Then do a visual check by either a) looking at the screenshot that `npm run graphene check <mdPath>` creates, or b) using your browser tool to open the .md file at `localhost:<port>/mdPath` (without the .md extension; default port 4000).
|
|
1323
|
+
- Critique what you see: Are all the data values formatted in a way that is easy to read? Does the shape of the visualized data require an adjustment to scale, axis min/max, etc.? Are any visualizations missing data altogether? Is that visualization type really the best way to paint the picture? Etc.
|