@graphenedata/cli 0.0.1

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.
Files changed (123) hide show
  1. package/LICENSE.md +100 -0
  2. package/THIRD_PARTY_NOTICES.md +12 -0
  3. package/cli.ts +157 -0
  4. package/dist/cli/cli.js +43 -0
  5. package/dist/docs/data_apps/components/charts/annotations.md +673 -0
  6. package/dist/docs/data_apps/components/charts/area-chart.md +202 -0
  7. package/dist/docs/data_apps/components/charts/bar-chart.md +317 -0
  8. package/dist/docs/data_apps/components/charts/box-plot.md +190 -0
  9. package/dist/docs/data_apps/components/charts/bubble-chart.md +151 -0
  10. package/dist/docs/data_apps/components/charts/calendar-heatmap.md +112 -0
  11. package/dist/docs/data_apps/components/charts/custom-echarts.md +308 -0
  12. package/dist/docs/data_apps/components/charts/echarts-options.md +217 -0
  13. package/dist/docs/data_apps/components/charts/funnel-chart.md +106 -0
  14. package/dist/docs/data_apps/components/charts/heatmap.md +180 -0
  15. package/dist/docs/data_apps/components/charts/histogram.md +107 -0
  16. package/dist/docs/data_apps/components/charts/line-chart.md +265 -0
  17. package/dist/docs/data_apps/components/charts/mixed-type-charts.md +240 -0
  18. package/dist/docs/data_apps/components/charts/sankey-diagram.md +301 -0
  19. package/dist/docs/data_apps/components/charts/scatter-plot.md +134 -0
  20. package/dist/docs/data_apps/components/charts/sparkline.md +68 -0
  21. package/dist/docs/data_apps/components/data/big-value.md +153 -0
  22. package/dist/docs/data_apps/components/data/delta.md +89 -0
  23. package/dist/docs/data_apps/components/data/table.md +470 -0
  24. package/dist/docs/data_apps/components/data/value.md +97 -0
  25. package/dist/docs/data_apps/components/inputs/button-group.md +154 -0
  26. package/dist/docs/data_apps/components/inputs/checkbox.md +52 -0
  27. package/dist/docs/data_apps/components/inputs/date-input.md +131 -0
  28. package/dist/docs/data_apps/components/inputs/date-range.md +124 -0
  29. package/dist/docs/data_apps/components/inputs/dimension-grid.md +67 -0
  30. package/dist/docs/data_apps/components/inputs/dropdown.md +199 -0
  31. package/dist/docs/data_apps/components/inputs/index.md +3 -0
  32. package/dist/docs/data_apps/components/inputs/slider.md +126 -0
  33. package/dist/docs/data_apps/components/inputs/text-input.md +86 -0
  34. package/dist/docs/data_apps/components/maps/area-map.md +397 -0
  35. package/dist/docs/data_apps/components/maps/base-map.md +269 -0
  36. package/dist/docs/data_apps/components/maps/bubble-map.md +361 -0
  37. package/dist/docs/data_apps/components/maps/point-map.md +326 -0
  38. package/dist/docs/data_apps/components/maps/us-map.md +167 -0
  39. package/dist/docs/data_apps/components/ui/accordion.md +116 -0
  40. package/dist/docs/data_apps/components/ui/alert.md +37 -0
  41. package/dist/docs/data_apps/components/ui/big-link.md +19 -0
  42. package/dist/docs/data_apps/components/ui/details.md +58 -0
  43. package/dist/docs/data_apps/components/ui/download-data.md +41 -0
  44. package/dist/docs/data_apps/components/ui/embed.md +47 -0
  45. package/dist/docs/data_apps/components/ui/grid.md +45 -0
  46. package/dist/docs/data_apps/components/ui/image.md +61 -0
  47. package/dist/docs/data_apps/components/ui/info.md +47 -0
  48. package/dist/docs/data_apps/components/ui/last-refreshed.md +28 -0
  49. package/dist/docs/data_apps/components/ui/link-button.md +20 -0
  50. package/dist/docs/data_apps/components/ui/link.md +40 -0
  51. package/dist/docs/data_apps/components/ui/modal.md +57 -0
  52. package/dist/docs/data_apps/components/ui/note.md +32 -0
  53. package/dist/docs/data_apps/components/ui/print-format-components.md +85 -0
  54. package/dist/docs/data_apps/components/ui/tabs.md +122 -0
  55. package/dist/docs/graphene.md +129 -0
  56. package/dist/ui/app.css +332 -0
  57. package/dist/ui/assets/favicon.ico +0 -0
  58. package/dist/ui/component-utilities/autoFormatting.js +301 -0
  59. package/dist/ui/component-utilities/builtInFormats.js +482 -0
  60. package/dist/ui/component-utilities/chartContext.js +12 -0
  61. package/dist/ui/component-utilities/chartWindowDebug.js +21 -0
  62. package/dist/ui/component-utilities/checkInputs.js +95 -0
  63. package/dist/ui/component-utilities/convert.js +15 -0
  64. package/dist/ui/component-utilities/dateParsing.js +57 -0
  65. package/dist/ui/component-utilities/dropdownContext.ts +1 -0
  66. package/dist/ui/component-utilities/echarts.js +262 -0
  67. package/dist/ui/component-utilities/echartsThemes.js +453 -0
  68. package/dist/ui/component-utilities/formatTitle.js +24 -0
  69. package/dist/ui/component-utilities/formatting.js +258 -0
  70. package/dist/ui/component-utilities/getColumnExtents.js +79 -0
  71. package/dist/ui/component-utilities/getColumnSummary.js +67 -0
  72. package/dist/ui/component-utilities/getCompletedData.js +114 -0
  73. package/dist/ui/component-utilities/getDistinctCount.js +7 -0
  74. package/dist/ui/component-utilities/getDistinctValues.js +15 -0
  75. package/dist/ui/component-utilities/getSeriesConfig.js +236 -0
  76. package/dist/ui/component-utilities/getSortedData.js +7 -0
  77. package/dist/ui/component-utilities/getStackPercentages.js +43 -0
  78. package/dist/ui/component-utilities/getStackedData.js +17 -0
  79. package/dist/ui/component-utilities/getYAxisIndex.js +15 -0
  80. package/dist/ui/component-utilities/globalContexts.js +1 -0
  81. package/dist/ui/component-utilities/helpers/getCompletedData.helpers.js +119 -0
  82. package/dist/ui/component-utilities/inputUtils.ts +25 -0
  83. package/dist/ui/component-utilities/replaceNulls.js +14 -0
  84. package/dist/ui/component-utilities/tableUtils.ts +120 -0
  85. package/dist/ui/component-utilities/themeStores.ts +116 -0
  86. package/dist/ui/components/Area.svelte +174 -0
  87. package/dist/ui/components/AreaChart.svelte +150 -0
  88. package/dist/ui/components/Bar.svelte +326 -0
  89. package/dist/ui/components/BarChart.svelte +194 -0
  90. package/dist/ui/components/BigValue.svelte +69 -0
  91. package/dist/ui/components/Chart.svelte +1070 -0
  92. package/dist/ui/components/Column.svelte +172 -0
  93. package/dist/ui/components/DateRange.svelte +324 -0
  94. package/dist/ui/components/Dropdown.svelte +738 -0
  95. package/dist/ui/components/DropdownOption.svelte +21 -0
  96. package/dist/ui/components/ECharts.svelte +77 -0
  97. package/dist/ui/components/ErrorChart.svelte +54 -0
  98. package/dist/ui/components/GrapheneQuery.svelte +12 -0
  99. package/dist/ui/components/InlineDelta.svelte +150 -0
  100. package/dist/ui/components/Line.svelte +210 -0
  101. package/dist/ui/components/LineChart.svelte +178 -0
  102. package/dist/ui/components/PieChart.svelte +36 -0
  103. package/dist/ui/components/QueryLoad.svelte +82 -0
  104. package/dist/ui/components/Row.svelte +14 -0
  105. package/dist/ui/components/SortIcon.svelte +32 -0
  106. package/dist/ui/components/Table.svelte +19 -0
  107. package/dist/ui/components/TableCell.svelte +75 -0
  108. package/dist/ui/components/TableGroupRow.svelte +136 -0
  109. package/dist/ui/components/TableGroupToggle.svelte +42 -0
  110. package/dist/ui/components/TableHeader.svelte +242 -0
  111. package/dist/ui/components/TableRow.svelte +283 -0
  112. package/dist/ui/components/TableSubtotalRow.svelte +62 -0
  113. package/dist/ui/components/TableTotalRow.svelte +88 -0
  114. package/dist/ui/components/TextInput.svelte +92 -0
  115. package/dist/ui/components/_Table.svelte +516 -0
  116. package/dist/ui/internal/clientCache.ts +43 -0
  117. package/dist/ui/internal/queryEngine.ts +169 -0
  118. package/dist/ui/internal/telemetry.ts +28 -0
  119. package/dist/ui/internal/theme.ts +88 -0
  120. package/dist/ui/layout.svelte +3 -0
  121. package/dist/ui/playwright.config.ts +30 -0
  122. package/dist/ui/web.js +106 -0
  123. package/package.json +71 -0
@@ -0,0 +1,470 @@
1
+ ---
2
+ title: Table
3
+ description: Display a richly formatted table of data, in a dense, readable format.
4
+ ---
5
+
6
+ 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.
7
+
8
+ ## Examples
9
+
10
+ ### Displaying All Columns in Query
11
+
12
+
13
+ ```svelte
14
+ <Table data="orders_summary"/>
15
+ ```
16
+
17
+ ### Selecting Specific Columns
18
+
19
+ ```svelte
20
+ <Table data="orders_summary">
21
+ <Column id=state title="Sales State"/>
22
+ <Column id=item/>
23
+ <Column id=category/>
24
+ <Column id=sales fmt=usd/>
25
+ <Column id=channel/>
26
+ </Table>
27
+ ```
28
+
29
+ ### Custom Column Formatting
30
+
31
+ You can use the `fmt` prop to format your columns using [built-in format names or Excel format codes](/core-concepts/formatting)
32
+
33
+ ```svelte
34
+ <Table data="country_summary">
35
+ <Column id=country />
36
+ <Column id=category />
37
+ <Column id=value_usd fmt=eur/>
38
+ <Column id=yoy title="Y/Y Growth" fmt=pct3/>
39
+ </Table>
40
+ ```
41
+
42
+ ### Search
43
+
44
+ ```svelte
45
+ <Table data="orders_summary" search=true/>
46
+ ```
47
+
48
+ ### Sort
49
+
50
+ ```svelte
51
+ <Table data="orders_summary" sort="sales desc">
52
+ <Column id=category/>
53
+ <Column id=item/>
54
+ <Column id=sales fmt=usd/>
55
+ </Table>
56
+ ```
57
+
58
+ ### Deltas
59
+
60
+ ```svelte
61
+ <Table data="country_summary">
62
+ <Column id=country />
63
+ <Column id=category />
64
+ <Column id=value_usd />
65
+ <Column id=yoy contentType=delta fmt=pct title="Y/Y Chg"/>
66
+ </Table>
67
+ ```
68
+
69
+ ### Sparklines
70
+
71
+ Sparklines require an array inside a cell of your table. You can create an array using the `array_agg()` function in DuckDB syntax.
72
+
73
+
74
+ ```svelte
75
+ <Table data="categories">
76
+ <Column id=category/>
77
+ <Column id=sales title="Orders" contentType=sparkline sparkX=date sparkY=sales />
78
+ <Column id=sales title="Sales" contentType=sparkarea sparkX=date sparkY=sales sparkColor=#53768a/>
79
+ <Column id=sales title="AOV" contentType=sparkbar sparkX=date sparkY=sales sparkColor=#97ba99/>
80
+ </Table>
81
+ ```
82
+
83
+ ### Bar Chart Column
84
+
85
+ ```svelte
86
+ <Table data="country_summary">
87
+ <Column id=country />
88
+ <Column id=category align=center/>
89
+ <Column id=value_usd title="Sales" contentType=bar/>
90
+ <Column id=value_usd title="Sales" contentType=bar barColor=#aecfaf/>
91
+ <Column id=value_usd title="Sales" contentType=bar barColor=#ffe08a backgroundColor=#ebebeb/>
92
+ </Table>
93
+ ```
94
+
95
+ ### Total Row
96
+
97
+ Default total aggregation is `sum`
98
+
99
+ ```svelte
100
+ <Table data="country_example" totalRow=true rows=5>
101
+ <Column id=country/>
102
+ <Column id=gdp_usd/>
103
+ <Column id=gdp_growth fmt='pct2'/>
104
+ <Column id=population fmt='#,##0"M"'/>
105
+ </Table>
106
+ ```
107
+
108
+ ### Conditional Formatting
109
+
110
+ #### Default (`colorScale=default`)
111
+
112
+ ```svelte
113
+ <Table data="countries">
114
+ <Column id=country />
115
+ <Column id=country_id align=center/>
116
+ <Column id=category align=center/>
117
+ <Column id=value_usd contentType=colorscale/>
118
+ </Table>
119
+ ```
120
+
121
+ #### Custom Colors
122
+
123
+ ```svelte
124
+ <Table data="orders_by_category" rowNumbers=true>
125
+ <Column id=month/>
126
+ <Column id=category/>
127
+ <Column id=sales_usd0k contentType=colorscale colorScale=#a85ab8 align=center/>
128
+ <Column id=num_orders_num0 contentType=colorscale colorScale=#e3af05 align=center/>
129
+ <Column id=aov_usd2 contentType=colorscale colorScale=#c43957 align=center/>
130
+ </Table>
131
+ ```
132
+
133
+ ### Including Images
134
+
135
+ You can include images by indicating either an absolute path e.g. `https://www.example.com/images/image.png` or a relative path e.g. `/images/image.png`.
136
+
137
+ ```svelte
138
+ <Table data="countries">
139
+ <Column id=flag contentType=image height=30px align=center />
140
+ <Column id=country />
141
+ <Column id=country_id align=center />
142
+ <Column id=category />
143
+ <Column id=value_usd />
144
+ </Table>
145
+ ```
146
+
147
+ ### Link Columns
148
+
149
+ #### Link Column with Unique Labels
150
+
151
+ ```svelte
152
+ <Table data="countries">
153
+ <Column id=country_url contentType=link linkLabel=country />
154
+ <Column id=country_id align=center />
155
+ <Column id=category />
156
+ <Column id=value_usd />
157
+ </Table>
158
+ ```
159
+
160
+ #### Link Column with Consistent String Label
161
+
162
+ ```svelte
163
+ <Table data="countries">
164
+ <Column id=country />
165
+ <Column id=country_id align=center />
166
+ <Column id=category />
167
+ <Column id=value_usd />
168
+ <Column id=country_url contentType=link linkLabel="Details &rarr;" />
169
+ </Table>
170
+ ```
171
+
172
+ ### HTML Content
173
+
174
+
175
+ ```svelte
176
+ <Table data="html_in_table">
177
+ <Column id="HTML in Table" contentType=html/>
178
+ </Table>
179
+ ```
180
+
181
+ To apply styling to most HTML tags, you should add the `class=markdown` attribute to the tag in your column. This will apply the same styling as the markdown renderer.
182
+
183
+ ### Row Links
184
+
185
+ #### External Links
186
+
187
+ ```svelte
188
+ <Table data="countries" search=true link=country_url>
189
+ <Column id=country />
190
+ <Column id=country_id align=center />
191
+ <Column id=category />
192
+ <Column id=value_usd />
193
+ </Table>
194
+ ```
195
+
196
+ #### Link to Pages in Your App
197
+
198
+
199
+ ```svelte
200
+ <Table data="orders" link=category_link />
201
+ ```
202
+
203
+ By default, the link column of your table is hidden. If you would like it to be displayed in the table, you can use `showLinkCol=true`.
204
+
205
+ ### Styling
206
+
207
+ #### Row Shading + Row Lines
208
+
209
+ ```svelte
210
+ <Table data="countries" rowShading=true />
211
+ ```
212
+
213
+ #### Row Shading + No Row Lines
214
+
215
+ ```svelte
216
+ <Table data="countries" rowShading=true rowLines=false />
217
+ ```
218
+
219
+ #### No Lines or Shading
220
+
221
+ ```svelte
222
+ <Table data="countries" rowLines=false />
223
+ ```
224
+
225
+ ### Column Alignment
226
+
227
+ ```svelte
228
+ <Table data="country_summary">
229
+ <Column id=country align=right />
230
+ <Column id=country_id align=center />
231
+ <Column id=category align=left />
232
+ <Column id=value_usd align=left />
233
+ </Table>
234
+ ```
235
+
236
+ ### Custom Column Titles
237
+
238
+ ```svelte
239
+ <Table data="country_summary">
240
+ <Column id=country title="Country Name" />
241
+ <Column id=country_id align=center title="ID" />
242
+ <Column id=category align=center title="Product Category" />
243
+ <Column id=value_usd title="Sales in 2022" />
244
+ </Table>
245
+ ```
246
+
247
+ ### Raw Column Names
248
+
249
+ ```svelte
250
+ <Table data="country_summary" formatColumnTitles=false />
251
+ ```
252
+
253
+ ### Groups - Accordion
254
+
255
+ #### Without subtotals
256
+
257
+ ```svelte
258
+ <Table data="orders" groupBy=state>
259
+ <Column id=state/>
260
+ <Column id=category totalAgg=""/>
261
+ <Column id=item totalAgg=""/>
262
+ <Column id=orders/>
263
+ <Column id=sales fmt=usd/>
264
+ <Column id=growth fmt=pct1/>
265
+ </Table>
266
+ ```
267
+
268
+ #### With Subtotals
269
+
270
+ ```svelte
271
+ <Table data="orders" groupBy=state subtotals=true>
272
+ <Column id=state/>
273
+ <Column id=category totalAgg=""/>
274
+ <Column id=item totalAgg=""/>
275
+ <Column id=orders/>
276
+ <Column id=sales fmt=usd/>
277
+ <Column id=growth fmt=pct1/>
278
+ </Table>
279
+ ```
280
+
281
+ ### Groups - Section
282
+
283
+ #### Without subtotals
284
+
285
+ ```svelte
286
+ <Table data="orders" groupBy=state groupType=section/>
287
+ ```
288
+
289
+ #### With Subtotals
290
+
291
+ ```svelte
292
+ <Table data="orders" groupBy=state subtotals=true groupType=section>
293
+ <Column id=state totalAgg=countDistinct totalFmt='[=1]0 "state";0 "states"'/>
294
+ <Column id=category totalAgg=Total/>
295
+ <Column id=item totalAgg=countDistinct totalFmt='0 "items"'/>
296
+ <Column id=orders/>
297
+ <Column id=sales fmt=usd1k/>
298
+ <Column id=growth contentType=delta neutralMin=-0.02 neutralMax=0.02 fmt=pct1 totalAgg=weightedMean weightCol=sales />
299
+ </Table>
300
+ ```
301
+
302
+ ### Column Groups
303
+
304
+ ```svelte
305
+ <Table data="countries" totalRow=true rows=5 groupBy=continent groupType=section totalRowColor=#f2f2f2>
306
+ <Column id=continent totalAgg="Total" totalFmt='# "Unique continents"'/>
307
+ <Column id=country totalAgg=countDistinct totalFmt='0 "countries"'/>
308
+ <Column id=gdp_usd totalAgg=sum fmt='$#,##0"B"' totalFmt='$#,##0.0,"T"' colGroup="GDP"/>
309
+ <Column id=gdp_growth totalAgg=weightedMean weightCol=gdp_usd fmt='pct1' colGroup="GDP" contentType=delta/>
310
+ <Column id=jobless_rate totalAgg=weightedMean weightCol=gdp_usd fmt='pct1' contentType=colorscale colorScale=negative colGroup="Labour Market"/>
311
+ <Column id=population totalAgg=sum fmt='#,##0"M"' totalFmt='#,##0.0,"B"' colGroup="Labour Market"/>
312
+ <Column id=interest_rate totalAgg=weightedMean weightCol=gdp_usd fmt='pct2' wrapTitle=false colGroup="Other"/>
313
+ <Column id=inflation_rate totalAgg=weightedMean weightCol=gdp_usd fmt='pct2' colGroup="Other"/>
314
+ <Column id=gov_budget totalAgg=weightedMean weightCol=gdp_usd fmt='0.0"%"' contentType=delta colGroup="Other"/>
315
+ <Column id=current_account totalAgg=weightedMean weightCol=gdp_usd fmt='0.0"%"' colGroup="Other"/>
316
+ </Table>
317
+ ```
318
+
319
+ ### Wrap Titles
320
+
321
+ ```svelte
322
+ <Table data="countries" wrapTitles=true />
323
+ ```
324
+
325
+ # Table
326
+
327
+ ## Options
328
+
329
+ | Name | Description | Required | Options | Default |
330
+ |------|-------------|----------|---------|---------|
331
+ | data | Query name, wrapped in curly braces | true | query name | - |
332
+ | 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 |
333
+ | title | Title for the table | false | string | - |
334
+ | subtitle | Subtitle - appears under the title | false | string | - |
335
+ | headerColor | Background color of the header row | false | Hex color code \| css color name | - |
336
+ | headerFontColor | Font color of the header row | false | Hex color code \| css color name | - |
337
+ | totalRow | Show a total row at the bottom of the table, defaults to sum of all numeric columns | false | ['true', 'false'] | false |
338
+ | totalRowColor | Background color of the total row | false | Hex color code \| css color name | - |
339
+ | totalFontColor | Font color of the total row | false | Hex color code \| css color name | - |
340
+ | rowNumbers | Turns on or off row index numbers | false | ['true', 'false'] | false |
341
+ | rowLines | Turns on or off borders at the bottom of each row | false | ['true', 'false'] | true |
342
+ | rowShading | Shades every second row in light grey | false | ['true', 'false'] | false |
343
+ | backgroundColor | Background color of the table | false | Hex color code \| css color name | "-" |
344
+ | sortable | Enable sort for each column - click the column title to sort | false | ['true', 'false'] | true |
345
+ | 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' | "-" |
346
+ | search | Add a search bar to the top of your table | false | ['true', 'false'] | false |
347
+ | downloadable | Enable download data button below the table on hover | false | ['true', 'false'] | true |
348
+ | formatColumnTitles | Enable auto-formatting of column titles. Turn off to show raw SQL column names | false | ['true', 'false'] | true |
349
+ | wrapTitles | Wrap column titles | false | ['true', 'false'] | false |
350
+ | compact | Enable a more compact table view that allows more content vertically and horizontally | false | ['true', 'false'] | false |
351
+ | link | Makes each row of your table a clickable link. Accepts the name of a column containing the link to use for each row in your table | false | column name | "-" |
352
+ | showLinkCol | Whether to show the column supplied to the `link` prop | false | ['true', 'false'] | false |
353
+ | 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 |
354
+ | 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" |
355
+ | 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" |
356
+
357
+ ### Groups
358
+ Groups allow you to create sections within your table, increasing the density of the content you're displaying. Groups are currently limited to 1 level, but will be expanded in future versions.
359
+
360
+ | Name | Description | Required | Options | Default |
361
+ |------|-------------|----------|---------|---------|
362
+ | groupBy | Column to use to create groups. Note that groups are currently limited to a single group column. | false | column name | - |
363
+ | 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" |
364
+ | subtotals | Whether to show aggregated totals for the groups | false | ['true', 'false'] | false |
365
+ | subtotalFmt | Specify an override format to use in the subtotal row ([see available formats](/core-concepts/formatting)). Custom strings or values are unformatted by default. | false | Excel-style format \| built-in format \| custom format | - |
366
+ | groupsOpen | [groupType=accordion] Whether to show the accordions as open on page load | false | ['true', 'false'] | true |
367
+ | accordionRowColor | [groupType=accordion] Background color for the accordion row | false | Hex color code \| css color name | - |
368
+ | subtotalRowColor | [groupType=section] Background color for the subtotal row | false | Hex color code \| css color name | - |
369
+ | subtotalFontColor | [groupType=section] Font color for the subtotal row | false | Hex color code \| css color name | - |
370
+ | groupNamePosition | [groupType=section] Where the group label will appear in its cell | false | ['top', 'middle', 'bottom'] | "middle" |
371
+
372
+ # Column
373
+
374
+ Use the `Column` 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.
375
+
376
+ ## Options
377
+
378
+ | Name | Description | Required | Options | Default |
379
+ |------|-------------|----------|---------|---------|
380
+ | id | Column id (from SQL query) | true | column name | - |
381
+ | title | Override title of column | false | string | column name (formatted) |
382
+ | description | Adds an info icon with description tooltip on hover | false | string | - |
383
+ | align | Align column text | false | ['left', 'center', 'right'] | "left" |
384
+ | fmt | Format the values in the column ([see available formats](/core-concepts/formatting)) | false | Excel-style format \| built-in format \| custom format | - |
385
+ | 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 | - |
386
+ | 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" |
387
+ | totalFmt | Specify an override format to use in the total row ([see available formats](/core-concepts/formatting)). Custom strings or values are unformatted by default. | false | Excel-style format \| built-in format \| custom format | - |
388
+ | weightCol | Column 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 | - |
389
+ | wrap | Wrap column text | false | ['true', 'false'] | "false" |
390
+ | wrapTitle | Wrap column title | false | ['true', 'false'] | "false" |
391
+ | contentType | Lets you specify how to treat the content within a column. See below for contentType-specific options. | false | ['link', 'image', 'delta', 'colorscale', 'html'] | - |
392
+ | 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 | - |
393
+ | redNegatives | Conditionally sets the font color to red based on whether the selected value is less than 0 | false | [`true`, `false`] | "false" |
394
+
395
+ ### Images
396
+
397
+ `contentType=image`
398
+
399
+ | Name | Description | Required | Options | Default |
400
+ |------|-------------|----------|---------|---------|
401
+ | height | Height of image in pixels | false | number | original height of image |
402
+ | width | Width of image in pixels | false | number | original width of image |
403
+ | alt | Alt text for image | false | column name | Name of the image file (excluding the file extension) |
404
+
405
+ ### Links
406
+
407
+ `contentType=link`
408
+
409
+ | Name | Description | Required | Options | Default |
410
+ |------|-------------|----------|---------|---------|
411
+ | linkLabel | Text to display for link | false | column name \| string | raw url |
412
+ | openInNewTab | Whether to open link in new tab | false | ['true', 'false'] | "false" |
413
+
414
+ ### Deltas
415
+
416
+ `contentType=delta`
417
+
418
+ | Name | Description | Required | Options | Default |
419
+ |------|-------------|----------|---------|---------|
420
+ | deltaSymbol | Whether to show the up/down delta arrow symbol | false | ['true', 'false'] | "true" |
421
+ | downIsGood | If present, negative comparison values appear in green, and positive values appear in red. | false | ['true', 'false'] | "false" |
422
+ | showValue | Whether to show the delta value. Set this to false to show only the delta arrow indicator. | false | ['true', 'false'] | "true" |
423
+ | 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" |
424
+ | 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" |
425
+ | chip | Whether to display the delta as a 'chip', with a background color and border. | false | ['true', 'false'] | "false" |
426
+
427
+ ### Sparklines
428
+
429
+ `contentType=sparkline`
430
+ `contentType=sparkarea`
431
+ `contentType=sparkbar`
432
+
433
+ | Name | Description | Required | Options | Default |
434
+ |------|-------------|----------|---------|---------|
435
+ | 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 | - |
436
+ | 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 | - |
437
+ | sparkYScale | Whether to truncate the y-axis | false | ['true', 'false'] | "false" |
438
+ | sparkHeight | Height of the spark viz. Making the viz taller will increase the height of the full table row | false | number | 18 |
439
+ | sparkWidth | Width of the spark viz | false | number | 90 |
440
+ | sparkColor | Color of the spark viz | false | [ 'Hex color code', 'css color name'] | - |
441
+
442
+ ### Bar Chart Column
443
+
444
+ `contentType=bar`
445
+
446
+ | Name | Description | Required | Options | Default |
447
+ |------|-------------|----------|---------|---------|
448
+ | barColor | Color of the bars. Affects positive bars only. See `negativeBarColor` to change color of negative bars | false | [ 'Hex color code', 'css color name'] | - |
449
+ | negativeBarColor | Color of negative bars | false | [ 'Hex color code', 'css color name'] | - |
450
+ | hideLabels | Whether to hide the data labels on the bars | false | ['true', 'false'] | "false" |
451
+ | backgroundColor | Background color for bar chart | false | [ 'Hex color code', 'css color name'] | "transparent" |
452
+
453
+ ### Conditional Formatting (Color Scales)
454
+
455
+ `contentType=colorscale`
456
+
457
+ | Name | Description | Required | Options | Default |
458
+ |------|-------------|----------|---------|---------|
459
+ | colorScale | Color to use for the scale | false | - | "green" |
460
+ | 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 |
461
+ | colorMid | Set a midpoint for the scale | false | number | mid of column |
462
+ | 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 |
463
+ | colorBreakpoints | Array of numbers to use as breakpoints for each color in your color scale. Should line up with the colors you provide in `colorScale` | false | array of numbers | - |
464
+ | scaleColumn | Column 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 | - |
465
+
466
+ ### HTML
467
+
468
+ `contentType=html`
469
+
470
+ To apply styling to HTML tags, you will need to add the `class=markdown` attribute **to the HTML tag in your column**. This will apply the same styling as the markdown renderer. E.g., `<code class=markdown>Code</code>`
@@ -0,0 +1,97 @@
1
+ ---
2
+ title: Value
3
+ description: Display a formatted value from a query inline in text.
4
+ ---
5
+
6
+ Use a Value component to display a formatted value from a query inline in text.
7
+
8
+ By default, `Value` will display the value from the first row of the first column of the referenced data.
9
+
10
+ ```markdown
11
+ <Value data="query_name" /> <!-- First row from the first column -->
12
+ ```
13
+
14
+ ## Specifying Rows and Columns
15
+
16
+ Optionally supply a `column` and/or a `row` argument to display other values from `data`.
17
+
18
+ > **Info**
19
+ >
20
+ > **Row Index**
21
+ >
22
+ > `row` is zero-indexed, so `row=0` displays the first row.
23
+
24
+ ```markdown
25
+ <!-- Show the **7th row** from column_name -->
26
+
27
+ <Value
28
+ data="query_name"
29
+ column=column_name
30
+ row=6
31
+ />
32
+ ```
33
+
34
+ ## Example
35
+
36
+ **Markdown:**
37
+
38
+ ```markdown
39
+ The most recent month of data began <Value data="monthly_orders" />,
40
+ when there were <Value data="monthly_orders" column=orders/> orders.
41
+ ```
42
+
43
+ **Results:**
44
+ ![summary-sentence](/img/tutorial-img/needful-things-value-in-text-nowindow.png)
45
+
46
+ ## Adding a Placeholder
47
+
48
+ Override errors with the optional `placeholder` argument. This is useful for drafting reports _before_ writing your queries.
49
+
50
+ ```markdown
51
+ <Value placeholder="sales last year"/>
52
+ ```
53
+
54
+ Sales in the last fiscal year were <Value placeholder="sales last year"/>, a change of <Value placeholder="X%"/> vs. the prior year.
55
+
56
+ ## Formatting Values
57
+ Graphene supports a variety of formats - see [value formatting](/core-concepts/formatting) and the `fmt` prop below for more info.
58
+
59
+ ## Aggregated Values
60
+
61
+ Values support basic aggregations such as, `min`, `max`, `median`, `sum`, `avg`
62
+
63
+
64
+ ```markdown
65
+ <Value data="orders" column="sales" agg="avg" fmt="usd0" />
66
+ ```
67
+
68
+ ## Customize Color Values
69
+
70
+ ```markdown
71
+ <Value data="orders" column="sales" agg="avg" fmt="usd0" color="#85BB65" />
72
+ ```
73
+
74
+ ## Red Negative Values
75
+
76
+
77
+ If the value is negative, the font color will automatically change to red, overriding any color specified by the color prop.
78
+
79
+ ```markdown
80
+ <Value data="NegativeSales" column="max_sales" agg="avg" fmt="usd0" redNegatives="true" />
81
+ ```
82
+
83
+ ## Options
84
+
85
+ | Name | Description | Required | Options | Default |
86
+ |------|-------------|----------|---------|---------|
87
+ | data | Query name, wrapped in curly braces | true | query name | - |
88
+ | column | Column to pull values from | false | column name | First column |
89
+ | row | Row number to display. 0 is the first row. | false | number | "0" |
90
+ | placeholder | Text to display in place of an error | false | string | - |
91
+ | fmt | Format to use for the value ([see available formats](/core-concepts/formatting)) | false | Excel-style format \| built-in format \| custom format | - |
92
+ | 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" |
93
+ | 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" |
94
+ | agg | Adds aggregation to query, column name required. | false | ['sum', 'avg', 'min', 'median', 'max'] | null |
95
+ | color | Specifies the font color of the Value. | false | CSS name \| hexademical \| RGB \| HSL | - |
96
+ | redNegatives | Conditionally sets the font color to red based on whether the selected value is less than 0 | false | [`true`, `false`] | "false" |
97
+ | description | Adds an info icon with description tooltip on hover | false | string | - |