@graphenedata/cli 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -0
- package/dist/cli/bigQuery-I3F46SC6.js +75 -0
- package/dist/cli/bigQuery-I3F46SC6.js.map +7 -0
- package/dist/cli/chunk-OVWODUTJ.js +12849 -0
- package/dist/cli/chunk-OVWODUTJ.js.map +7 -0
- package/dist/cli/chunk-QAXEOZ43.js +53 -0
- package/dist/cli/chunk-QAXEOZ43.js.map +7 -0
- package/dist/cli/cli.js +234 -11197
- package/dist/cli/clickhouse-ZN5AN2UL.js +64 -0
- package/dist/cli/clickhouse-ZN5AN2UL.js.map +7 -0
- package/dist/cli/duckdb-IYBIO5KJ.js +87 -0
- package/dist/cli/duckdb-IYBIO5KJ.js.map +7 -0
- package/dist/cli/serve2-TNN5EROW.js +447 -0
- package/dist/cli/serve2-TNN5EROW.js.map +7 -0
- package/dist/cli/snowflake-MOQB5GA4.js +128 -0
- package/dist/cli/snowflake-MOQB5GA4.js.map +7 -0
- package/dist/index.d.ts +63 -0
- package/dist/lang/index.d.ts +63 -0
- package/dist/skills/graphene/SKILL.md +150 -96
- package/dist/skills/graphene/references/big-value.md +6 -41
- package/dist/skills/graphene/references/date-range.md +64 -0
- package/dist/skills/graphene/references/dropdown.md +3 -4
- package/dist/skills/graphene/references/echarts.md +162 -0
- package/dist/skills/graphene/references/gsql.md +55 -25
- package/dist/skills/graphene/references/model-gsql.md +72 -0
- package/dist/skills/graphene/references/table.md +13 -14
- package/dist/skills/graphene/references/text-input.md +2 -1
- package/dist/ui/app.css +239 -340
- package/dist/ui/component-utilities/dataShaping.ts +484 -0
- package/dist/ui/component-utilities/dataSummary.ts +57 -0
- package/dist/ui/component-utilities/enrich.ts +763 -0
- package/dist/ui/component-utilities/format.ts +177 -0
- package/dist/ui/component-utilities/inputUtils.ts +44 -8
- package/dist/ui/component-utilities/theme.ts +200 -0
- package/dist/ui/component-utilities/themeStores.ts +21 -8
- package/dist/ui/component-utilities/types.ts +70 -0
- package/dist/ui/components/AreaChart.svelte +57 -105
- package/dist/ui/components/BarChart.svelte +71 -129
- package/dist/ui/components/BigValue.svelte +24 -40
- package/dist/ui/components/Column.svelte +10 -18
- package/dist/ui/components/DateRange.svelte +54 -21
- package/dist/ui/components/Dropdown.svelte +47 -26
- package/dist/ui/components/DropdownOption.svelte +1 -2
- package/dist/ui/components/ECharts.svelte +181 -67
- package/dist/ui/components/InlineDelta.svelte +50 -31
- package/dist/ui/components/LineChart.svelte +54 -125
- package/dist/ui/components/PieChart.svelte +27 -37
- package/dist/ui/components/QueryLoad.svelte +77 -45
- package/dist/ui/components/Row.svelte +2 -1
- package/dist/ui/components/ScatterPlot.svelte +52 -0
- package/dist/ui/components/Skeleton.svelte +32 -0
- package/dist/ui/components/Table.svelte +3 -2
- package/dist/ui/components/TableGroupRow.svelte +28 -36
- package/dist/ui/components/TableHarness.svelte +32 -0
- package/dist/ui/components/TableHeader.svelte +34 -59
- package/dist/ui/components/TableRow.svelte +14 -38
- package/dist/ui/components/TableSubtotalRow.svelte +18 -21
- package/dist/ui/components/TableTotalRow.svelte +27 -37
- package/dist/ui/components/TextInput.svelte +13 -12
- package/dist/ui/components/Value.svelte +25 -0
- package/dist/ui/components/_Table.svelte +72 -70
- package/dist/ui/internal/ChartGallery.svelte +527 -0
- package/dist/ui/internal/ErrorDisplay.svelte +22 -97
- package/dist/ui/internal/LocalApp.svelte +80 -17
- package/dist/ui/internal/PageNavGroup.svelte +269 -0
- package/dist/ui/internal/Sidebar.svelte +178 -0
- package/dist/ui/internal/SidebarToggle.svelte +47 -0
- package/dist/ui/internal/StyleGallery.svelte +244 -0
- package/dist/ui/internal/clientCache.ts +2 -2
- package/dist/ui/internal/pageInputs.svelte.js +292 -0
- package/dist/ui/internal/queryEngine.ts +102 -117
- package/dist/ui/internal/runSocket.ts +32 -12
- package/dist/ui/internal/sidebar.svelte.js +18 -0
- package/dist/ui/internal/telemetry.ts +51 -16
- package/dist/ui/internal/types.d.ts +7 -0
- package/dist/ui/web.js +28 -11
- package/package.json +36 -38
- package/dist/skills/graphene/references/area-chart.md +0 -95
- package/dist/skills/graphene/references/bar-chart.md +0 -112
- package/dist/skills/graphene/references/line-chart.md +0 -108
- package/dist/skills/graphene/references/pie-chart.md +0 -29
- package/dist/skills/graphene/references/value-formats.md +0 -104
- package/dist/ui/component-utilities/autoFormatting.js +0 -280
- package/dist/ui/component-utilities/builtInFormats.js +0 -481
- package/dist/ui/component-utilities/chartContext.js +0 -12
- package/dist/ui/component-utilities/chartWindowDebug.js +0 -21
- package/dist/ui/component-utilities/checkInputs.js +0 -84
- package/dist/ui/component-utilities/convert.js +0 -15
- package/dist/ui/component-utilities/dateParsing.js +0 -56
- package/dist/ui/component-utilities/dropdownContext.ts +0 -1
- package/dist/ui/component-utilities/echarts.js +0 -252
- package/dist/ui/component-utilities/echartsThemes.js +0 -443
- package/dist/ui/component-utilities/formatTitle.js +0 -24
- package/dist/ui/component-utilities/formatting.js +0 -241
- package/dist/ui/component-utilities/getColumnExtents.js +0 -79
- package/dist/ui/component-utilities/getColumnSummary.js +0 -62
- package/dist/ui/component-utilities/getCompletedData.js +0 -122
- package/dist/ui/component-utilities/getDistinctCount.js +0 -7
- package/dist/ui/component-utilities/getDistinctValues.js +0 -15
- package/dist/ui/component-utilities/getSeriesConfig.js +0 -231
- package/dist/ui/component-utilities/getSortedData.js +0 -9
- package/dist/ui/component-utilities/getStackPercentages.js +0 -45
- package/dist/ui/component-utilities/getStackedData.js +0 -19
- package/dist/ui/component-utilities/getYAxisIndex.js +0 -15
- package/dist/ui/component-utilities/globalContexts.js +0 -1
- package/dist/ui/component-utilities/helpers/getCompletedData.helpers.js +0 -119
- package/dist/ui/component-utilities/replaceNulls.js +0 -16
- package/dist/ui/component-utilities/tableUtils.ts +0 -107
- package/dist/ui/component-utilities/tidyWithTypes.js +0 -9
- package/dist/ui/components/Area.svelte +0 -214
- package/dist/ui/components/Bar.svelte +0 -347
- package/dist/ui/components/Chart.svelte +0 -995
- package/dist/ui/components/Line.svelte +0 -227
- package/dist/ui/internal/NavSidebar.svelte +0 -396
- package/dist/ui/internal/theme.ts +0 -60
- package/dist/ui/public/inter-latin-ext.woff2 +0 -0
- package/dist/ui/public/inter-latin.woff2 +0 -0
package/package.json
CHANGED
|
@@ -1,71 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphenedata/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"license": "Elastic-2.0",
|
|
5
5
|
"author": "Graphene Systems Inc",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"bin": {
|
|
7
8
|
"graphene": "./bin.js"
|
|
8
9
|
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist",
|
|
11
|
-
"bin.js",
|
|
12
|
-
"package.json",
|
|
13
|
-
"LICENSE.md",
|
|
14
|
-
"THIRD_PARTY_NOTICES.md"
|
|
15
|
-
],
|
|
16
|
-
"type": "module",
|
|
17
10
|
"main": "bin.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
18
12
|
"exports": {
|
|
19
13
|
"./ui": {
|
|
20
14
|
"browser": "./dist/ui/web.js"
|
|
21
15
|
}
|
|
22
16
|
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"test": "vitest run cli --root ..",
|
|
26
|
-
"test-one": "node ../scripts/turboTest.js",
|
|
27
|
-
"prepack": "pnpm run build"
|
|
28
|
-
},
|
|
29
|
-
"dependencies": {
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@clickhouse/client": "^1.18.2",
|
|
30
19
|
"@duckdb/node-api": "1.3.2-alpha.26",
|
|
31
20
|
"@google-cloud/bigquery": "^8.2.0",
|
|
21
|
+
"snowflake-sdk": "2.4.0"
|
|
22
|
+
},
|
|
23
|
+
"peerDependenciesMeta": {
|
|
24
|
+
"@clickhouse/client": {
|
|
25
|
+
"optional": true
|
|
26
|
+
},
|
|
27
|
+
"@duckdb/node-api": {
|
|
28
|
+
"optional": true
|
|
29
|
+
},
|
|
30
|
+
"@google-cloud/bigquery": {
|
|
31
|
+
"optional": true
|
|
32
|
+
},
|
|
33
|
+
"snowflake-sdk": {
|
|
34
|
+
"optional": true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@fontsource/inter": "^5.2.8",
|
|
42
|
+
"@fontsource/jetbrains-mono": "^5.2.8",
|
|
43
|
+
"@fontsource/source-sans-3": "^5.2.9",
|
|
44
|
+
"@fontsource/source-serif-4": "^5.2.9",
|
|
32
45
|
"@graphenedata/html2canvas": "^1.4.1",
|
|
33
46
|
"@lezer/common": "^1.2.3",
|
|
34
47
|
"@lezer/lr": "^1.4.2",
|
|
35
48
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
36
|
-
"@tidyjs/tidy": "^2.5.2",
|
|
37
49
|
"chalk": "^5.3.0",
|
|
38
|
-
"chokidar": "3.6.0",
|
|
39
50
|
"chroma-js": "2.4.2",
|
|
51
|
+
"ci-info": "^4.4.0",
|
|
40
52
|
"cli-table3": "^0.6.3",
|
|
41
53
|
"commander": "^11.0.0",
|
|
42
|
-
"debounce": "^1.2.1",
|
|
43
54
|
"dotenv": "^17.2.3",
|
|
44
|
-
"echarts": "^
|
|
55
|
+
"echarts": "^6.0.0",
|
|
56
|
+
"entities": "^4.5.0",
|
|
45
57
|
"fs-extra": "11.2.0",
|
|
46
58
|
"glob": "^13.0.1",
|
|
47
|
-
"
|
|
59
|
+
"js-yaml": "^3.14.2",
|
|
60
|
+
"json5": "^2.2.3",
|
|
48
61
|
"mdsvex": "^0.12.6",
|
|
49
|
-
"nanoid": "3.3.8",
|
|
50
62
|
"sanitize-html": "^2.17.0",
|
|
51
|
-
"
|
|
52
|
-
"ssf": "^0.11.2",
|
|
53
|
-
"svelte": "5.53.7",
|
|
63
|
+
"svelte": "5.55.3",
|
|
54
64
|
"unified": "^11.0.5",
|
|
55
65
|
"unist-util-visit": "4.1.2",
|
|
56
|
-
"vite": "7.3.
|
|
66
|
+
"vite": "7.3.2",
|
|
57
67
|
"ws": "^8.18.0"
|
|
58
|
-
},
|
|
59
|
-
"devDependencies": {
|
|
60
|
-
"@types/fs-extra": "^11.0.4",
|
|
61
|
-
"@types/node": "^20.0.0",
|
|
62
|
-
"@types/sanitize-html": "^2.16.0",
|
|
63
|
-
"@types/ws": "^8.18.1",
|
|
64
|
-
"esbuild": "^0.27.2",
|
|
65
|
-
"vitest": "4.0.18",
|
|
66
|
-
"vscode-languageserver-types": "^3.17.0"
|
|
67
|
-
},
|
|
68
|
-
"engines": {
|
|
69
|
-
"node": ">=20"
|
|
70
68
|
}
|
|
71
69
|
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
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.
|
|
2
|
-
|
|
3
|
-
Here's an example:
|
|
4
|
-
|
|
5
|
-
```markdown
|
|
6
|
-
<AreaChart
|
|
7
|
-
data=orders_by_month
|
|
8
|
-
x=month
|
|
9
|
-
y=sales
|
|
10
|
-
/>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
# Attributes
|
|
14
|
-
|
|
15
|
-
## General
|
|
16
|
-
|
|
17
|
-
| Attribute | Description | Required | Options | Default |
|
|
18
|
-
|------|-------------|----------|---------|---------|
|
|
19
|
-
| title | Chart title. Appears at top left of chart. | false | string | - |
|
|
20
|
-
| subtitle | Chart subtitle. Appears just under title. | false | string | - |
|
|
21
|
-
| legend | Turn legend on or off. Legend appears at top center of chart. | false | `true`, `false` | `true` for multiple series |
|
|
22
|
-
| 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` |
|
|
23
|
-
| 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` |
|
|
24
|
-
| downloadableData | Whether to show the download button to allow users to download the data | false | `true`, `false` | `true` |
|
|
25
|
-
| downloadableImage | Whether to show the button to allow users to save the chart as an image | false | `true`, `false` | `true` |
|
|
26
|
-
|
|
27
|
-
## Data
|
|
28
|
-
|
|
29
|
-
| Attribute | Description | Required | Options | Default |
|
|
30
|
-
|------|-------------|----------|---------|---------|
|
|
31
|
-
| data | GSQL query or table name | true | query name | - |
|
|
32
|
-
| x | Column or expression to use for the x-axis of the chart | true | column name, stored expression name, GSQL expression | First column |
|
|
33
|
-
| y | Column(s) or expression(s) to use for the y-axis of the chart. Each will create its own series. Consider a split axis with `y2` if there is a difference of scale or unit of measure between the series. | true | column name, stored expression name, GSQL expression, list of any combination of these e.g. `"col1, my_expr"` | Any non-assigned numeric columns |
|
|
34
|
-
| series | Column or expression to use to define the series (groups) in a multi-series chart. Use when values of a particular column dictate the multiple series to plot, eg. `country` would create a series for every distinct country in the column. | false | column name, stored expression name, GSQL expression | - |
|
|
35
|
-
| 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` |
|
|
36
|
-
| type | Grouping method to use for multi-series charts | false | `stacked`, `stacked100` | `stacked` |
|
|
37
|
-
| handleMissing | Treatment of missing values in the dataset | false | `gap`, `connect`, `zero` | `gap` for single series, `zero` for multi-series |
|
|
38
|
-
| 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` |
|
|
39
|
-
| 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" |
|
|
40
|
-
|
|
41
|
-
## Formatting and styling
|
|
42
|
-
|
|
43
|
-
| Attribute | Description | Required | Options | Default |
|
|
44
|
-
|------|-------------|----------|---------|---------|
|
|
45
|
-
| xFmt | Format to use for x column ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
46
|
-
| yFmt | Format to use for y column ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
47
|
-
| seriesLabelFmt | Format to use for series label ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
48
|
-
| step | Specifies whether the chart is displayed as a step line | false | `true`, `false` | `false` |
|
|
49
|
-
| stepPosition | Configures the position of turn points for a step line chart | false | `start`, `middle`, `end` | `end` |
|
|
50
|
-
| fillColor | Color to override default series color. Only accepts a single color. | false | CSS name, hexademical, RGB, HSL | - |
|
|
51
|
-
| lineColor | Color to override default line color. Only accepts a single color. | false | CSS name, hexademical, RGB, HSL | - |
|
|
52
|
-
| fillOpacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | `0.7` |
|
|
53
|
-
| line | Show line on top of the area | false | `true`, `false` | `true` |
|
|
54
|
-
| 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 |
|
|
55
|
-
| 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 e.g. `"Canada, US"` | default order implied by the data |
|
|
56
|
-
| leftPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | false | number | - |
|
|
57
|
-
| rightPadding | Number representing the padding (whitespace) on the right side of the chart. Useful to avoid labels getting cut off | false | number | - |
|
|
58
|
-
| xLabelWrap | Whether to wrap x-axis labels when there is not enough space. Default behaviour is to truncate the labels. | false | `true`, `false` | `false` |
|
|
59
|
-
|
|
60
|
-
## Value Labels
|
|
61
|
-
|
|
62
|
-
| Attribute | Description | Required | Options | Default |
|
|
63
|
-
|------|-------------|----------|---------|---------|
|
|
64
|
-
| labels | Show value labels | false | `true`, `false` | `false` |
|
|
65
|
-
| labelSize | Font size of value labels | false | number | `11` |
|
|
66
|
-
| labelPosition | Where label will appear on your series | false | `above`, `middle`, `below` | `above` |
|
|
67
|
-
| labelColor | Font color of value labels | false | CSS name, hexademical, RGB, HSL | Automatic based on color contrast of background |
|
|
68
|
-
| labelFmt | Format to use for value labels ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | same as y column |
|
|
69
|
-
| showAllLabels | Allow all labels to appear on chart, including overlapping labels | false | `true`, `false` | `false` |
|
|
70
|
-
|
|
71
|
-
## Axes
|
|
72
|
-
|
|
73
|
-
| Attribute | Description | Required | Options | Default |
|
|
74
|
-
|------|-------------|----------|---------|---------|
|
|
75
|
-
| yLog | Whether to use a log scale for the y-axis | false | `true`, `false` | `false` |
|
|
76
|
-
| yLogBase | Base to use when log scale is enabled | false | number | `10` |
|
|
77
|
-
| xAxisTitle | Name to show under x-axis. If 'true', formatted column name is used. Only works with swapXY=false | false | `true`, `string`, `false` | `false` |
|
|
78
|
-
| yAxisTitle | Name to show beside y-axis. If 'true', formatted column name is used. | false | `true`, `string`, `false` | `false` |
|
|
79
|
-
| xGridlines | Turns on/off gridlines extending from x-axis tick marks (vertical lines when swapXY=false) | false | `true`, `false` | `false` |
|
|
80
|
-
| yGridlines | Turns on/off gridlines extending from y-axis tick marks (horizontal lines when swapXY=false) | false | `true`, `false` | `true` |
|
|
81
|
-
| xAxisLabels | Turns on/off value labels on the x-axis | false | `true`, `false` | `true` |
|
|
82
|
-
| yAxisLabels | Turns on/off value labels on the y-axis | false | `true`, `false` | `true` |
|
|
83
|
-
| xBaseline | Turns on/off thick axis line (line appears at y=0) | false | `true`, `false` | `true` |
|
|
84
|
-
| yBaseline | Turns on/off thick axis line (line appears directly alongside the y-axis labels) | false | `true`, `false` | `false` |
|
|
85
|
-
| xTickMarks | Turns on/off tick marks for each of the x-axis labels | false | `true`, `false` | `false` |
|
|
86
|
-
| yTickMarks | Turns on/off tick marks for each of the y-axis labels | false | `true`, `false` | `false` |
|
|
87
|
-
| yMin | Starting value for the y-axis | false | number | - |
|
|
88
|
-
| yMax | Maximum value for the y-axis | false | number | - |
|
|
89
|
-
| yScale | Whether to scale the y-axis to fit your data. `yMin` and `yMax` take precedence over `yScale` | false | `true`, `false` | `false` |
|
|
90
|
-
|
|
91
|
-
## Interactivity
|
|
92
|
-
|
|
93
|
-
| Attribute | Description | Required | Options | Default |
|
|
94
|
-
|------|-------------|----------|---------|---------|
|
|
95
|
-
| connectGroup | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected | false | - | - |
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
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.
|
|
2
|
-
|
|
3
|
-
Here's an example:
|
|
4
|
-
|
|
5
|
-
```markdown
|
|
6
|
-
<BarChart
|
|
7
|
-
title="Sales by Category"
|
|
8
|
-
data=orders_by_category_2021
|
|
9
|
-
x=month
|
|
10
|
-
y=sales
|
|
11
|
-
series=category
|
|
12
|
-
/>
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
# Attributes
|
|
16
|
-
|
|
17
|
-
## General
|
|
18
|
-
|
|
19
|
-
| Attribute | Description | Options | Default |
|
|
20
|
-
|----------|-------------|---------|---------|
|
|
21
|
-
| title | Chart title. Appears at top left of chart. | string | - |
|
|
22
|
-
| subtitle | Chart subtitle. Appears just under title. | string | - |
|
|
23
|
-
| legend | Turns legend on or off. Legend appears at top center of chart. | `true`, `false` | `true` for multiple series |
|
|
24
|
-
| 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` |
|
|
25
|
-
| renderer | Which chart renderer type (canvas or SVG) to use. See ECharts' documentation on renderers. | `canvas`, `svg` | `canvas` |
|
|
26
|
-
| downloadableData | Whether to show the download button to allow users to download the data | `true`, `false` | `true` |
|
|
27
|
-
| downloadableImage | Whether to show the button to allow users to save the chart as an image | `true`, `false` | `true` |
|
|
28
|
-
|
|
29
|
-
## Data
|
|
30
|
-
|
|
31
|
-
| Attribute | Description | Required | Options | Default |
|
|
32
|
-
|----------|-------------|----------|---------|---------|
|
|
33
|
-
| data | GSQL query or table name | true | query name | - |
|
|
34
|
-
| x | Column or expression to use for the x-axis of the chart | false | column name, stored expression name, GSQL expression | First column |
|
|
35
|
-
| y | Column(s) or expression(s) to use for the y-axis of the chart. Each will create its own series. Consider a split axis with `y2` if there is a difference of scale or unit of measure between the series. | false | column name, stored expression name, GSQL expression, list of any combination of these e.g. `"col1, my_expr"` | Any non-assigned numeric columns |
|
|
36
|
-
| 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 e.g. `"col1, my_expr"` | - |
|
|
37
|
-
| y2SeriesType | Chart type to apply to the series on the y2 axis | false | `bar`, `line`, `scatter` | `bar` |
|
|
38
|
-
| series | Column or expression to use to define the series (groups) in a multi-series chart. Use when values of a particular column dictate the multiple series to plot, eg. `country` would create a series for every distinct country in the column. | false | column name, stored expression name, GSQL expression | - |
|
|
39
|
-
| 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` |
|
|
40
|
-
| type | Grouping method to use for multi-series charts | false | `stacked`, `grouped`, `stacked100` | `stacked` |
|
|
41
|
-
| stackName | Name for an individual stack. If separate Bar components are used with different stackNames, the chart will show multiple stacks | false | string | - |
|
|
42
|
-
| 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` |
|
|
43
|
-
| 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 |
|
|
44
|
-
|
|
45
|
-
## Formatting and styling
|
|
46
|
-
|
|
47
|
-
| Attribute | Description | Options | Default |
|
|
48
|
-
|----------|-------------|---------|---------|
|
|
49
|
-
| xFmt | Format to use for x column ([see available formats](#value-formatting)) | Excel-style format, built-in format name | - |
|
|
50
|
-
| yFmt | Format to use for y column ([see available formats](#value-formatting)) | Excel-style format, built-in format name | - |
|
|
51
|
-
| y2Fmt | Format to use for y2 column(s) ([see available formats](#value-formatting)) | Excel-style format, built-in format name | - |
|
|
52
|
-
| seriesLabelFmt | Format to use for series label ([see available formats](#value-formatting)) | Excel-style format, built-in format name | - |
|
|
53
|
-
| fillColor | Color to override default series color. Only accepts a single color. | CSS name, hexademical, RGB, HSL | - |
|
|
54
|
-
| fillOpacity | % of the full color that should be rendered, with remainder being transparent | number (0 to 1) | `1` |
|
|
55
|
-
| outlineWidth | Width of line surrounding each bar | number | `0` |
|
|
56
|
-
| outlineColor | Color to use for outline if outlineWidth > 0 | CSS name, hexademical, RGB, HSL | - |
|
|
57
|
-
| 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 |
|
|
58
|
-
| 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 e.g. `"Canada, US"` | default order implied by the data |
|
|
59
|
-
| leftPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | number | - |
|
|
60
|
-
| rightPadding | Number representing the padding (whitespace) on the right side of the chart. Useful to avoid labels getting cut off | number | - |
|
|
61
|
-
| xLabelWrap | Whether to wrap x-axis labels when there is not enough space. Default behaviour is to truncate the labels. | `true`, `false` | `false` |
|
|
62
|
-
|
|
63
|
-
## Value labels
|
|
64
|
-
|
|
65
|
-
| Attribute | Description | Options | Default |
|
|
66
|
-
|----------|-------------|---------|---------|
|
|
67
|
-
| labels | Show value labels | `true`, `false` | `false` |
|
|
68
|
-
| stackTotalLabel | If using labels, whether to show a total at the top of stacked bar chart | `true`, `false` | `true` |
|
|
69
|
-
| seriesLabels | If using labels, whether to show series labels | `true`, `false` | `true` |
|
|
70
|
-
| labelSize | Font size of value labels | number | `11` |
|
|
71
|
-
| labelPosition | Where label will appear on your series | `outside`, `inside` | Single Series: `outside`, Stacked: `inside`, Grouped: `outside` |
|
|
72
|
-
| labelColor | Font color of value labels | CSS name, hexademical, RGB, HSL | Automatic based on color contrast of background |
|
|
73
|
-
| labelFmt | Format to use for value labels ([see available formats](#value-formatting)) | Excel-style format, built-in format name | same as y column |
|
|
74
|
-
| 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 | - |
|
|
75
|
-
| 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 | - |
|
|
76
|
-
| showAllLabels | Allow all labels to appear on chart, including overlapping labels | `true`, `false` | `false` |
|
|
77
|
-
|
|
78
|
-
## Axes
|
|
79
|
-
|
|
80
|
-
| Attribute | Description | Options | Default |
|
|
81
|
-
|----------|-------------|---------|---------|
|
|
82
|
-
| swapXY | Swap the x and y axes to create a horizontal chart | `true`, `false` | `false` |
|
|
83
|
-
| yLog | Whether to use a log scale for the y-axis | `true`, `false` | `false` |
|
|
84
|
-
| yLogBase | Base to use when log scale is enabled | number | `10` |
|
|
85
|
-
| xAxisTitle | Name to show under x-axis. If 'true', formatted column name is used. Only works with swapXY=false | string, `true`, `false` | `false` |
|
|
86
|
-
| yAxisTitle | Name to show beside y-axis. If 'true', formatted column name is used. | string, `true`, `false` | `false` |
|
|
87
|
-
| y2AxisTitle | Name to show beside y2 axis. If 'true', formatted column name is used. | string, `true`, `false` | `false` |
|
|
88
|
-
| xGridlines | Turns on/off gridlines extending from x-axis tick marks (vertical lines when swapXY=false) | `true`, `false` | `false` |
|
|
89
|
-
| yGridlines | Turns on/off gridlines extending from y-axis tick marks (horizontal lines when swapXY=false) | `true`, `false` | `true` |
|
|
90
|
-
| y2Gridlines | Turns on/off gridlines extending from y2-axis tick marks (horizontal lines when swapXY=false) | `true`, `false` | `true` |
|
|
91
|
-
| xAxisLabels | Turns on/off value labels on the x-axis | `true`, `false` | `true` |
|
|
92
|
-
| yAxisLabels | Turns on/off value labels on the y-axis | `true`, `false` | `true` |
|
|
93
|
-
| y2AxisLabels | Turns on/off value labels on the y2-axis | `true`, `false` | `true` |
|
|
94
|
-
| xBaseline | Turns on/off thick axis line (line appears at y=0) | `true`, `false` | `true` |
|
|
95
|
-
| yBaseline | Turns on/off thick axis line (line appears directly alongside the y-axis labels) | `true`, `false` | `false` |
|
|
96
|
-
| y2Baseline | Turns on/off thick axis line (line appears directly alongside the y2-axis labels) | `true`, `false` | `false` |
|
|
97
|
-
| xTickMarks | Turns on/off tick marks for each of the x-axis labels | `true`, `false` | `false` |
|
|
98
|
-
| yTickMarks | Turns on/off tick marks for each of the y-axis labels | `true`, `false` | `false` |
|
|
99
|
-
| y2TickMarks | Turns on/off tick marks for each of the y2-axis labels | `true`, `false` | `false` |
|
|
100
|
-
| yMin | Starting value for the y-axis | number | - |
|
|
101
|
-
| yMax | Maximum value for the y-axis | number | - |
|
|
102
|
-
| yScale | Whether to scale the y-axis to fit your data. `yMin` and `yMax` take precedence over `yScale` | `true`, `false` | `false` |
|
|
103
|
-
| y2Min | Starting value for the y2-axis | number | - |
|
|
104
|
-
| y2Max | Maximum value for the y2-axis | number | - |
|
|
105
|
-
| y2Scale | Whether to scale the y-axis to fit your data. `y2Min` and `y2Max` take precedence over `y2Scale` | `true`, `false` | `false` |
|
|
106
|
-
| 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 |
|
|
107
|
-
|
|
108
|
-
## Interactivity
|
|
109
|
-
|
|
110
|
-
| Attribute | Description | Options |
|
|
111
|
-
|----------|-------------|---------|
|
|
112
|
-
| connectGroup | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected | string |
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
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.
|
|
2
|
-
|
|
3
|
-
Here's an example:
|
|
4
|
-
|
|
5
|
-
```markdown
|
|
6
|
-
<LineChart
|
|
7
|
-
title="Monthly Sales"
|
|
8
|
-
subtitle="Includes all categories"
|
|
9
|
-
data=orders_by_month
|
|
10
|
-
x=month
|
|
11
|
-
y=sales_usd0k
|
|
12
|
-
yAxisTitle="Sales per Month"
|
|
13
|
-
/>
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
# Attributes
|
|
17
|
-
|
|
18
|
-
## General
|
|
19
|
-
|
|
20
|
-
| Attribute | Description | Required | Options | Default |
|
|
21
|
-
|------|-------------|----------|---------|---------|
|
|
22
|
-
| title | Chart title. Appears at top left of chart. | false | string | - |
|
|
23
|
-
| subtitle | Chart subtitle. Appears just under title. | false | string | - |
|
|
24
|
-
| legend | Turn legend on or off. Legend appears at top center of chart. | false | `true`, `false` | `true` for multiple series |
|
|
25
|
-
| 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` |
|
|
26
|
-
| 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` |
|
|
27
|
-
| downloadableData | Whether to show the download button to allow users to download the data | false | `true`, `false` | `true` |
|
|
28
|
-
| downloadableImage | Whether to show the button to allow users to save the chart as an image | false | `true`, `false` | `true` |
|
|
29
|
-
|
|
30
|
-
## Data
|
|
31
|
-
|
|
32
|
-
| Attribute | Description | Required | Options | Default |
|
|
33
|
-
|------|-------------|----------|---------|---------|
|
|
34
|
-
| data | GSQL query or table name | true | query name | - |
|
|
35
|
-
| x | Column or expression to use for the x-axis of the chart | true | column name, stored expression name, GSQL expression | - |
|
|
36
|
-
| y | Column(s) or expression(s) to use for the y-axis of the chart. Each will create its own series. Consider a split axis with `y2` if there is a difference of scale or unit of measure between the series. | true | column name, stored expression name, GSQL expression, list of any combination of these e.g. `"col1, my_expr"` | - |
|
|
37
|
-
| 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 e.g. `"col1, my_expr"` | - |
|
|
38
|
-
| y2SeriesType | Chart type to apply to the series on the y2 axis | false | `line`, `bar`, `scatter` | `line` |
|
|
39
|
-
| series | Column or expression to use to define the series (groups) in a multi-series chart. Use when values of a particular column dictate the multiple series to plot, eg. `country` would create a series for every distinct country in the column. | false | column name, stored expression name, GSQL expression | - |
|
|
40
|
-
| 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` |
|
|
41
|
-
| handleMissing | Treatment of missing values in the dataset | false | `gap`, `connect`, `zero` | `gap` |
|
|
42
|
-
| 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` |
|
|
43
|
-
| 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 | - |
|
|
44
|
-
|
|
45
|
-
## Formatting and styling
|
|
46
|
-
|
|
47
|
-
| Attribute | Description | Required | Options | Default |
|
|
48
|
-
|------|-------------|----------|---------|---------|
|
|
49
|
-
| xFmt | Format to use for x column ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
50
|
-
| yFmt | Format to use for y column(s) ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
51
|
-
| y2Fmt | Format to use for y2 column(s) ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
52
|
-
| seriesLabelFmt | Format to use for series label ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
53
|
-
| step | Specifies whether the chart is displayed as a step line | false | `true`, `false` | `false` |
|
|
54
|
-
| stepPosition | Configures the position of turn points for a step line chart | false | `start`, `middle`, `end` | `end` |
|
|
55
|
-
| lineColor | Color to override default series color. Only accepts a single color | false | CSS name, hexademical, RGB, HSL | - |
|
|
56
|
-
| lineOpacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | `1` |
|
|
57
|
-
| lineType | Options to show breaks in a line (dashed or dotted) | false | `solid`, `dashed`, `dotted` | `solid` |
|
|
58
|
-
| lineWidth | Thickness of line (in pixels) | false | number | `2` |
|
|
59
|
-
| markers | Turn on/off markers (shapes rendered onto the points of a line) | false | `true`, `false` | `false` |
|
|
60
|
-
| markerShape | Shape to use if markers=true | false | `circle`, `emptyCircle`, `rect`, `triangle`, `diamond` | `circle` |
|
|
61
|
-
| markerSize | Size of each shape (in pixels) | false | number | `8` |
|
|
62
|
-
| 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"` | - |
|
|
63
|
-
| 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 e.g. `"Canada, US"` | default order implied by the data |
|
|
64
|
-
| labels | Show value labels | false | `true`, `false` | `false` |
|
|
65
|
-
| labelSize | Font size of value labels | false | number | `11` |
|
|
66
|
-
| labelPosition | Where label will appear on your series | false | `above`, `middle`, `below` | `above` |
|
|
67
|
-
| labelColor | Font color of value labels | false | CSS name, hexademical, RGB, HSL | - |
|
|
68
|
-
| labelFmt | Format to use for value labels ([see available formats](#value-formatting)) | false | Excel-style format, built-in format name | - |
|
|
69
|
-
| 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 | - |
|
|
70
|
-
| 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 | - |
|
|
71
|
-
| showAllLabels | Allow all labels to appear on chart, including overlapping labels | false | `true`, `false` | `false` |
|
|
72
|
-
| leftPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | false | number | - |
|
|
73
|
-
| rightPadding | Number representing the padding (whitespace) on the right side of the chart. Useful to avoid labels getting cut off | false | number | - |
|
|
74
|
-
| xLabelWrap | Whether to wrap x-axis labels when there is not enough space. Default behaviour is to truncate the labels. | false | `true`, `false` | `false` |
|
|
75
|
-
|
|
76
|
-
## Axes
|
|
77
|
-
|
|
78
|
-
| Attribute | Description | Required | Options | Default |
|
|
79
|
-
|------|-------------|----------|---------|---------|
|
|
80
|
-
| yLog | Whether to use a log scale for the y-axis | false | `true`, `false` | `false` |
|
|
81
|
-
| yLogBase | Base to use when log scale is enabled | false | number | `10` |
|
|
82
|
-
| xAxisTitle | Name to show under x-axis. If 'true', formatted column name is used. Only works with swapXY=false | false | `true`, `string`, `false` | `false` |
|
|
83
|
-
| yAxisTitle | Name to show beside y-axis. If 'true', formatted column name is used. | false | `true`, `string`, `false` | `false` |
|
|
84
|
-
| y2AxisTitle | Name to show beside y2 axis. If 'true', formatted column name is used. | false | `true`, `string`, `false` | `false` |
|
|
85
|
-
| xGridlines | Turns on/off gridlines extending from x-axis tick marks (vertical lines when swapXY=false) | false | `true`, `false` | `false` |
|
|
86
|
-
| yGridlines | Turns on/off gridlines extending from y-axis tick marks (horizontal lines when swapXY=false) | false | `true`, `false` | `true` |
|
|
87
|
-
| y2Gridlines | Turns on/off gridlines extending from y2-axis tick marks (horizontal lines when swapXY=false) | false | `true`, `false` | `true` |
|
|
88
|
-
| xAxisLabels | Turns on/off value labels on the x-axis | false | `true`, `false` | `true` |
|
|
89
|
-
| yAxisLabels | Turns on/off value labels on the y-axis | false | `true`, `false` | `true` |
|
|
90
|
-
| y2AxisLabels | Turns on/off value labels on the y2-axis | false | `true`, `false` | `true` |
|
|
91
|
-
| xBaseline | Turns on/off thick axis line (line appears at y=0) | false | `true`, `false` | `true` |
|
|
92
|
-
| yBaseline | Turns on/off thick axis line (line appears directly alongside the y-axis labels) | false | `true`, `false` | `false` |
|
|
93
|
-
| y2Baseline | Turns on/off thick axis line (line appears directly alongside the y2-axis labels) | false | `true`, `false` | `false` |
|
|
94
|
-
| xTickMarks | Turns on/off tick marks for each of the x-axis labels | false | `true`, `false` | `false` |
|
|
95
|
-
| yTickMarks | Turns on/off tick marks for each of the y-axis labels | false | `true`, `false` | `false` |
|
|
96
|
-
| y2TickMarks | Turns on/off tick marks for each of the y2-axis labels | false | `true`, `false` | `false` |
|
|
97
|
-
| yMin | Starting value for the y-axis | false | number | - |
|
|
98
|
-
| yMax | Maximum value for the y-axis | false | number | - |
|
|
99
|
-
| yScale | Whether to scale the y-axis to fit your data. `yMin` and `yMax` take precedence over `yScale` | false | `true`, `false` | `false` |
|
|
100
|
-
| y2Min | Starting value for the y2-axis | false | number | - |
|
|
101
|
-
| y2Max | Maximum value for the y2-axis | false | number | - |
|
|
102
|
-
| y2Scale | Whether to scale the y-axis to fit your data. `y2Min` and `y2Max` take precedence over `y2Scale` | false | `true`, `false` | `false` |
|
|
103
|
-
|
|
104
|
-
## Interactivity
|
|
105
|
-
|
|
106
|
-
| Attribute | Description | Required | Options | Default |
|
|
107
|
-
|------|-------------|----------|---------|---------|
|
|
108
|
-
| connectGroup | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected | false | - | - |
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
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.
|
|
2
|
-
|
|
3
|
-
Here's an example:
|
|
4
|
-
|
|
5
|
-
```markdown
|
|
6
|
-
<PieChart
|
|
7
|
-
title="Sales share by category"
|
|
8
|
-
data=orders_by_category_2021
|
|
9
|
-
category=category
|
|
10
|
-
value=sales
|
|
11
|
-
/>
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
# Attributes
|
|
15
|
-
|
|
16
|
-
## General
|
|
17
|
-
|
|
18
|
-
| Attribute | Description | Options | Default |
|
|
19
|
-
|----------|-------------|---------|---------|
|
|
20
|
-
| title | Chart title. Appears at top left of chart. | string | - |
|
|
21
|
-
| subtitle | Chart subtitle. Appears just under title. | string | - |
|
|
22
|
-
|
|
23
|
-
## Data
|
|
24
|
-
|
|
25
|
-
| Attribute | Description | Required | Options | Default |
|
|
26
|
-
|------|-------------|----------|---------|---------|
|
|
27
|
-
| data | GSQL query or table name | true | query name | - |
|
|
28
|
-
| category | Column or expression to use for slice names | true | column name, stored expression name, GSQL expression | - |
|
|
29
|
-
| value | Column or expression to use for slice values | true | column name, stored expression name, GSQL expression | - |
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
The easiest way to format numbers and dates in Graphene is through component attributes. You can pass in either of the following:
|
|
2
|
-
|
|
3
|
-
* [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"`)
|
|
4
|
-
* [Graphene's built-in formats](#built-in-formats) (e.g., `fmt=usd2k`)
|
|
5
|
-
|
|
6
|
-
For example, you can use the `fmt` attribute to format values inside a BigValue component:
|
|
7
|
-
|
|
8
|
-
```markdown
|
|
9
|
-
<BigValue
|
|
10
|
-
data=sales_data
|
|
11
|
-
value=sales
|
|
12
|
-
fmt="$#,##0"
|
|
13
|
-
/>
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Within charts, you can format individual columns using `xFmt` and `yFmt`:
|
|
17
|
-
|
|
18
|
-
```markdown
|
|
19
|
-
<LineChart
|
|
20
|
-
data=sales_data
|
|
21
|
-
x=date
|
|
22
|
-
y=sales
|
|
23
|
-
xFmt="m/d"
|
|
24
|
-
yFmt=eur
|
|
25
|
-
/>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
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).
|
|
29
|
-
|
|
30
|
-
**Date formatting**
|
|
31
|
-
|
|
32
|
-
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.
|
|
33
|
-
|
|
34
|
-
# Built-in Formats
|
|
35
|
-
|
|
36
|
-
Graphene supports a variety of date/time, number, percentage, and currency formats.
|
|
37
|
-
|
|
38
|
-
## Auto-Formatting
|
|
39
|
-
|
|
40
|
-
Wherever you see `auto` listed beside a format, that means Graphene will automatically format your value based on the context it is in.
|
|
41
|
-
|
|
42
|
-
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).
|
|
43
|
-
|
|
44
|
-
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.
|
|
45
|
-
|
|
46
|
-
## Dates
|
|
47
|
-
|
|
48
|
-
Graphene supports the following date formats:
|
|
49
|
-
|
|
50
|
-
* `ddd` - Short day name (e.g., Mon, Tue)
|
|
51
|
-
* `dddd` - Full day name (e.g., Monday, Tuesday)
|
|
52
|
-
* `mmm` - Short month name (e.g., Jan, Feb)
|
|
53
|
-
* `mmmm` - Full month name (e.g., January, February)
|
|
54
|
-
* `yyyy` - Four-digit year
|
|
55
|
-
* `shortdate` - Short date format (e.g., Jan 9/22)
|
|
56
|
-
* `longdate` - Long date format (e.g., January 9, 2022)
|
|
57
|
-
* `fulldate` - Full date format (e.g., Monday January 9, 2022)
|
|
58
|
-
* `mdy` - Month/day/year (e.g., 1/9/22)
|
|
59
|
-
* `dmy` - Day/month/year (e.g., 9/1/22)
|
|
60
|
-
* `hms` - Time format (e.g., 11:45:03 AM)
|
|
61
|
-
|
|
62
|
-
## Currencies
|
|
63
|
-
|
|
64
|
-
Supported currencies include USD, AUD, BRL, CAD, CNY, EUR, GBP, JPY, INR, KRW, NGN, RUB, and SEK.
|
|
65
|
-
|
|
66
|
-
In order to use currency tags, use the currency code, optionally appended with:
|
|
67
|
-
|
|
68
|
-
* a number indicating the number of decimal places to show (0-2)
|
|
69
|
-
* a letter indicating the order of magnitude to show ("","k", "m", "b")
|
|
70
|
-
|
|
71
|
-
For example, the available tags for USD are:
|
|
72
|
-
|
|
73
|
-
* `usd` (auto) - Automatically formats based on value size
|
|
74
|
-
* `usd0`, `usd1`, `usd2` - USD with 0, 1, or 2 decimal places
|
|
75
|
-
* `usd0k`, `usd1k`, `usd2k` - USD in thousands (e.g., $64k)
|
|
76
|
-
* `usd0m`, `usd1m`, `usd2m` - USD in millions (e.g., $42M)
|
|
77
|
-
* `usd0b`, `usd1b`, `usd2b` - USD in billions (e.g., $1B)
|
|
78
|
-
|
|
79
|
-
Similar patterns apply to other supported currencies.
|
|
80
|
-
|
|
81
|
-
## Numbers
|
|
82
|
-
|
|
83
|
-
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).
|
|
84
|
-
|
|
85
|
-
Available number formats:
|
|
86
|
-
|
|
87
|
-
* `num0`, `num1`, `num2`, `num3`, `num4` - Numbers with 0-4 decimal places
|
|
88
|
-
* `num0k`, `num1k`, `num2k` - Numbers in thousands (e.g., 64k)
|
|
89
|
-
* `num0m`, `num1m`, `num2m` - Numbers in millions (e.g., 42M)
|
|
90
|
-
* `num0b`, `num1b`, `num2b` - Numbers in billions (e.g., 1B)
|
|
91
|
-
* `id` - Integer format for IDs
|
|
92
|
-
* `fract` - Fraction format
|
|
93
|
-
* `mult`, `mult0`, `mult1`, `mult2` - Multiplier format (e.g., 5.32x)
|
|
94
|
-
* `sci` - Scientific notation
|
|
95
|
-
|
|
96
|
-
## Percentages
|
|
97
|
-
|
|
98
|
-
Available percentage formats:
|
|
99
|
-
|
|
100
|
-
* `pct` (auto) - Automatically formats percentages based on value
|
|
101
|
-
* `pct0` - Percentage with 0 decimal places (e.g., 73%)
|
|
102
|
-
* `pct1` - Percentage with 1 decimal place (e.g., 73.1%)
|
|
103
|
-
* `pct2` - Percentage with 2 decimal places (e.g., 73.10%)
|
|
104
|
-
* `pct3` - Percentage with 3 decimal places (e.g., 73.100%)
|