@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,240 @@
1
+ ---
2
+ title: Mixed-Type Charts
3
+ description: Display multiple series types on the same chart, for example a bar for an amount, and a line for a related percentage.
4
+ ---
5
+
6
+ Use mixed-type charts to display multiple series types on the same chart, for example a bar for an amount, and a line for a related percentage.
7
+
8
+ Mixed-type charts can be confusing, so use them sparingly. To add reference lines, areas or points to a chart instead, see [Annotations](/components/charts/annotations).
9
+
10
+ > **Info**
11
+ >
12
+ > The easiest way to create mixed-type charts is setting up [a secondary y-axis in `LineChart`](/components/charts/line-chart#secondary-axis-with-bar) or a [secondary axis in `BarChart`](/components/charts/bar-chart#secondary-axis-with-line)
13
+
14
+ You can combine multiple chart types inside a single `<Chart>` tag to create mixed-type charts.
15
+
16
+ ## Examples
17
+
18
+ ### Mixed-Type Chart
19
+
20
+ This example uses multiple y columns and multiple series types (bar and line)
21
+
22
+ ```markdown
23
+ <Chart data="fda_recalls">
24
+ <Bar y=voluntary_recalls/>
25
+ <Line y=fda_recalls/>
26
+ </Chart>
27
+ ```
28
+
29
+ Because x is the first column in the dataset, an explicit `x` prop is not required.
30
+
31
+ This structure also gives you control over the individual series on your chart. For example, if you have a single series running through a component, you can override props specifically for that series. Since the FDA acronym was not fully capitalized above, you can rename that specific series inside the `<Line>` primitive:
32
+
33
+ ```markdown
34
+ <Chart data="fda_recalls">
35
+ <Bar y=voluntary_recalls/>
36
+ <Line y=fda_recalls name="FDA Recalls"/>
37
+ </Chart>
38
+ ```
39
+
40
+ # Chart `<Chart>`
41
+
42
+ ```markdown
43
+ <Chart data="query_name">
44
+ Insert primitives here
45
+ </Chart>
46
+ ```
47
+
48
+ ## Data
49
+
50
+ | Name | Description | Required | Options | Default |
51
+ |------|-------------|----------|---------|---------|
52
+ | data | Query name, wrapped in curly braces | true | query name | - |
53
+ | x | Column to use for the x-axis of the chart | false | column name | - |
54
+ | y | Column(s) to use for the y-axis of the chart | false | column name \| array of column names | - |
55
+ | 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" |
56
+ | series | Column to use as the series (groups) in a multi-series chart | false | column name | - |
57
+ | xFmt | Format to use for x column ([see available formats](/core-concepts/formatting)) | false | Excel-style format \| built-in format name \| custom format name | - |
58
+ | yFmt | Format to use for y column ([see available formats](/core-concepts/formatting)) | false | Excel-style format \| built-in format name \| custom format name | - |
59
+ | yLog | Whether to use a log scale for the y-axis | false | ['true', 'false'] | "false" |
60
+ | yLogBase | Base to use when log scale is enabled | false | number | 10 |
61
+ | 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" |
62
+ | 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" |
63
+
64
+ ## Chart
65
+
66
+ | Name | Description | Required | Options | Default |
67
+ |------|-------------|----------|---------|---------|
68
+ | swapXY | Swap the x and y axes to create a horizontal chart | false | ['true', 'false'] | "false" |
69
+ | title | Chart title. Appears at top left of chart. | false | string | - |
70
+ | subtitle | Chart subtitle. Appears just under title. | false | string | - |
71
+ | legend | Turns legend on or off. Legend appears at top center of chart. | false | ['true', 'false'] | true for multiple series |
72
+ | 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 |
73
+ | xAxisTitle | Name to show under x-axis. If 'true', formatted column name is used. Only works with swapXY=false | false | ['true', 'string', 'false'] | "false" |
74
+ | yAxisTitle | Name to show beside y-axis. If 'true', formatted column name is used. | false | ['true', 'string', 'false'] | "false" |
75
+ | xGridlines | Turns on/off gridlines extending from x-axis tick marks (vertical lines when swapXY=false) | false | ['true', 'false'] | "false" |
76
+ | yGridlines | Turns on/off gridlines extending from y-axis tick marks (horizontal lines when swapXY=false) | false | ['true', 'false'] | "true" |
77
+ | xAxisLabels | Turns on/off value labels on the x-axis | false | ['true', 'false'] | "true" |
78
+ | yAxisLabels | Turns on/off value labels on the y-axis | false | ['true', 'false'] | "true" |
79
+ | xBaseline | Turns on/off thick axis line (line appears at y=0) | false | ['true', 'false'] | "true" |
80
+ | yBaseline | Turns on/off thick axis line (line appears directly alongside the y-axis labels) | false | ['true', 'false'] | "false" |
81
+ | xTickMarks | Turns on/off tick marks for each of the x-axis labels | false | ['true', 'false'] | "false" |
82
+ | yTickMarks | Turns on/off tick marks for each of the y-axis labels | false | ['true', 'false'] | "false" |
83
+ | yMin | Starting value for the y-axis | false | number | - |
84
+ | yMax | Maximum value for the y-axis | false | number | - |
85
+ | yScale | Whether to scale the y-axis to fit your data. yMin and yMax take precedence over yScale | false | ['true', 'false'] | "false" |
86
+ | options | JavaScript object to add or override chart configuration settings (see Custom Charts page) | false | object | - |
87
+ | colorPalette | Array of custom colours to use for the chart. E.g., `{['#cf0d06','#eb5752','#e88a87']}` | false | array of color strings (CSS name \| hexademical \| RGB \| HSL) | built-in color palette |
88
+ | seriesColors | Apply a specific color to each series in your chart. Unspecified series will receive colors from the built-in palette as normal. Note the double curly braces required in the syntax `seriesColors={{"Canada": "red", "US": "blue"}}` | false | object with series names and assigned colors | colors applied by order of series in data |
89
+ | 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" |
90
+ | downloadableData | Whether to show the download button to allow users to download the data | false | ["true", "false"] | "true" |
91
+ | downloadableImage | Whether to show the button to allow users to save the chart as an image | false | ["true", "false"] | "true" |
92
+
93
+ # Line `<Line/>`
94
+
95
+ ```markdown
96
+ <Chart data="query_name">
97
+ <Line/>
98
+ </Chart>
99
+ ```
100
+
101
+ ## Options
102
+
103
+ | Name | Description | Required | Options | Default |
104
+ |------|-------------|----------|---------|---------|
105
+ | y | Column(s) to use for the y-axis of the chart. Can be different than the y supplied to Chart | false | column name \| array of column names | y supplied to Chart |
106
+ | series | Column to use as the series (groups) in a multi-series chart. Can be different than the series supplied to Chart | false | column name | series supplied to Chart |
107
+ | name | Name to show in legend for a single series (to override column name) | false | string | - |
108
+ | lineColor | Color to override default series color. Only accepts a single color. | false | CSS name \| hexademical \| RGB \| HSL | - |
109
+ | lineOpacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | 1 |
110
+ | lineType | Options to show breaks in a line (dashed or dotted) | false | ['solid', 'dashed', 'dotted'] | "solid" |
111
+ | lineWidth | Thickness of line (in pixels) | false | number | 2 |
112
+ | markers | Turn on/off markers (shapes rendered onto the points of a line) | false | ['true', 'false'] | "false" |
113
+ | markerShape | Shape to use if markers=true | false | ['circle', 'emptyCircle', 'rect', 'triangle', 'diamond'] | "circle" |
114
+ | markerSize | Size of each shape (in pixels) | false | number | 8 |
115
+ | handleMissing | Treatment of missing values in the dataset | false | ['gap', 'connect', 'zero'] | "gap" |
116
+ | options | JavaScript object to add or override chart configuration settings (see Custom Charts page) | false | object | - |
117
+
118
+ # Area `<Area/>`
119
+
120
+ ```markdown
121
+ <Chart data="query_name">
122
+ <Area/>
123
+ </Chart>
124
+ ```
125
+
126
+ ## Options
127
+
128
+ | Name | Description | Required | Options | Default |
129
+ |------|-------------|----------|---------|---------|
130
+ | y | Column(s) to use for the y-axis of the chart. Can be different than the y supplied to Chart | false | column name \| array of column names | y supplied to Chart |
131
+ | series | Column to use as the series (groups) in a multi-series chart. Can be different than the series supplied to Chart | false | column name | series supplied to Chart |
132
+ | name | Name to show in legend for a single series (to override column name) | false | string | - |
133
+ | fillColor | Color to override default series color. Only accepts a single color. | false | CSS name \| hexademical \| RGB \| HSL | - |
134
+ | fillOpacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | 0.7 |
135
+ | line | Show line on top of the area | false | ['true', 'false'] | "true" |
136
+ | handleMissing | Treatment of missing values in the dataset | false | ['gap', 'connect', 'zero'] | gap (single series) \| zero (multi-series) |
137
+ | options | JavaScript object to add or override chart configuration settings (see Custom Charts page) | false | object | - |
138
+
139
+ # Bar `<Bar/>`
140
+
141
+ ```markdown
142
+ <Chart data="query_name">
143
+ <Bar/>
144
+ </Chart>
145
+ ```
146
+
147
+ ## Options
148
+
149
+ | Name | Description | Required | Options | Default |
150
+ |------|-------------|----------|---------|---------|
151
+ | y | Column to use for the y-axis of the chart | false | column name | - |
152
+ | name | Name to show in legend for a single series (to override column name) | false | string | - |
153
+ | type | Grouping method to use for multi-series charts | false | ['stacked', 'grouped'] | "stacked" |
154
+ | stackName | Name for an individual stack. If separate Bar components are used with different stackNames, the chart will show multiple stacks | false | string | - |
155
+ | fillColor | Color to override default series color. Only accepts a single color. | false | CSS name \| hexademical \| RGB \| HSL | - |
156
+ | fillOpacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | 1 |
157
+ | outlineWidth | Width of line surrounding each bar | false | number | 0 |
158
+ | outlineColor | Color to use for outline if outlineWidth > 0 | false | CSS name \| hexademical \| RGB \| HSL | - |
159
+ | options | JavaScript object to add or override chart configuration settings (see Custom Charts page) | false | object | - |
160
+
161
+ # Scatter `<Scatter/>`
162
+
163
+ ```markdown
164
+ <Chart data="query_name">
165
+ <Scatter/>
166
+ </Chart>
167
+ ```
168
+
169
+ ## Options
170
+
171
+ | Name | Description | Required | Options | Default |
172
+ |------|-------------|----------|---------|---------|
173
+ | y | Column to use for the y-axis of the chart | false | column name | - |
174
+ | name | Name to show in legend for a single series (to override column name) | false | string | - |
175
+ | shape | Options for which shape to use for scatter points | false | ['circle', 'emptyCircle', 'rect', 'triangle', 'diamond'] | "circle" |
176
+ | pointSize | Change size of all points on the chart | false | number | 10 |
177
+ | opacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | 0.7 |
178
+ | fillColor | Color to override default series color. Only accepts a single color. | false | CSS name \| hexademical \| RGB \| HSL | - |
179
+ | outlineWidth | Width of line surrounding each shape | false | number | 0 |
180
+ | outlineColor | Color to use for outline if outlineWidth > 0 | false | CSS name \| hexademical \| RGB \| HSL | - |
181
+ | options | JavaScript object to add or override chart configuration settings (see Custom Charts page) | false | object | - |
182
+
183
+ # Bubble `<Bubble/>`
184
+
185
+ ```markdown
186
+ <Chart data="query_name">
187
+ <Bubble/>
188
+ </Chart>
189
+ ```
190
+
191
+ ## Options
192
+
193
+ | Name | Description | Required | Options | Default |
194
+ |------|-------------|----------|---------|---------|
195
+ | y | Column to use for the y-axis of the chart | false | column name | - |
196
+ | size | Column to use to scale the size of the bubbles | false | column name | - |
197
+ | name | Name to show in legend for a single series (to override column name) | false | string | - |
198
+ | shape | Options for which shape to use for bubble points | false | ['circle', 'emptyCircle', 'rect', 'triangle', 'diamond'] | "circle" |
199
+ | minSize | Minimum bubble size | false | number | 200 |
200
+ | maxSize | Maximum bubble size | false | number | 400 |
201
+ | opacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | 0.7 |
202
+ | fillColor | Color to override default series color. Only accepts a single color. | false | CSS name \| hexademical \| RGB \| HSL | - |
203
+ | outlineWidth | Width of line surrounding each shape | false | number | 0 |
204
+ | outlineColor | Color to use for outline if outlineWidth > 0 | false | CSS name \| hexademical \| RGB \| HSL | - |
205
+ | options | JavaScript object to add or override chart configuration settings (see Custom Charts page) | false | object | - |
206
+
207
+ # Hist `<Hist/>`
208
+
209
+ ```markdown
210
+ <Chart data="query_name">
211
+ <Hist/>
212
+ </Chart>
213
+ ```
214
+
215
+ ## Options
216
+
217
+ | Name | Description | Required | Options | Default |
218
+ |------|-------------|----------|---------|---------|
219
+ | x | Column which contains the data you want to summarize | false | column name | - |
220
+ | fillColor | Color to override default series color | false | CSS name \| hexademical \| RGB \| HSL | - |
221
+ | fillOpacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | 1 |
222
+ | options | JavaScript object to add or override chart configuration settings (see Custom Charts page) | false | object | - |
223
+
224
+ ### Interactivity
225
+
226
+ | Name | Description | Required | Options | Default |
227
+ |------|-------------|----------|---------|---------|
228
+ | connectGroup | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected | false | - | - |
229
+
230
+ ## Annotations
231
+
232
+ Mixed type charts can include [annotations](/components/charts/annotations) using the `ReferenceLine` and `ReferenceArea` components. These components are used within a chart component like so:
233
+
234
+ ```html
235
+ <Chart data="sales_data" x=date y=sales>
236
+ <Line y=sales/>
237
+ <ReferenceLine data="target_data" y=target label=name/>
238
+ <ReferenceArea xMin='2020-03-14' xMax='2020-05-01'/>
239
+ </Chart>
240
+ ```
@@ -0,0 +1,301 @@
1
+ ---
2
+ title: Sankey Diagram
3
+ description: Display flows of a metric transferring between different categories.
4
+ ---
5
+
6
+ Use Sankey diagrams to display flows of a metric transferring between different categories.
7
+
8
+ To display a flow with multiple levels, like these examples, see [Mutli-level](#multi-level) below.
9
+
10
+
11
+
12
+ ## Example
13
+
14
+ ```svelte
15
+ <SankeyDiagram
16
+ data="query_name"
17
+ sourceCol= sourceCol
18
+ targetCol = targetCol
19
+ valueCol= valueCol
20
+ />
21
+ ```
22
+
23
+ ## Vertical
24
+
25
+ ```svelte
26
+ <SankeyDiagram
27
+ data="query_name"
28
+ sourceCol=sourceCol
29
+ targetCol=targetCol
30
+ valueCol=valueCol
31
+ orient=vertical
32
+ />
33
+ ```
34
+
35
+ # Echarts Options String
36
+
37
+ ```svelte
38
+ <SankeyDiagram
39
+ data="traffic_data"
40
+ title="Sankey"
41
+ subtitle="A simple sankey chart"
42
+ sourceCol=source
43
+ targetCol=target
44
+ valueCol=count
45
+ echartsOptions="{
46
+ title: {
47
+ text: "Custom Echarts Option",
48
+ textStyle: {
49
+ color: '#476fff'
50
+ "
51
+ }
52
+ }}
53
+ />
54
+ ```
55
+
56
+ # Node Depth Override
57
+
58
+
59
+ ```svelte
60
+ <SankeyDiagram
61
+ data="apple_income_statement"
62
+ title="Apple Income Statement"
63
+ subtitle="USD Billions"
64
+ sourceCol=source
65
+ targetCol=target
66
+ valueCol=amount_usd
67
+ depthOverride="{'services revenue': 1"}
68
+ nodeAlign=left
69
+ />
70
+ ```
71
+
72
+ # Labels
73
+
74
+ ## Node Labels
75
+
76
+ ### `nodeLabels=name` (default)
77
+
78
+ ```svelte
79
+ <SankeyDiagram
80
+ data="simple_sankey"
81
+ sourceCol=source
82
+ targetCol=target
83
+ valueCol=amount
84
+ percentCol=percent
85
+ nodeLabels=name
86
+ />
87
+ ```
88
+
89
+ ### `nodeLabels=value`
90
+
91
+ ```svelte
92
+ <SankeyDiagram
93
+ data="simple_sankey"
94
+ sourceCol=source
95
+ targetCol=target
96
+ valueCol=amount
97
+ percentCol=percent
98
+ nodeLabels=value
99
+ />
100
+ ```
101
+
102
+ The value labels can be formatted using the `valueFmt` option.
103
+
104
+ ### `nodeLabels=full`
105
+
106
+ ```svelte
107
+ <SankeyDiagram
108
+ data="simple_sankey"
109
+ sourceCol=source
110
+ targetCol=target
111
+ valueCol=amount
112
+ percentCol=percent
113
+ nodeLabels=full
114
+ valueFmt=usd
115
+ />
116
+ ```
117
+
118
+ ## Link Labels
119
+
120
+ ### `linkLabels=full` (default)
121
+ Requires `percentCol` to show percentage beside value
122
+
123
+ ```svelte
124
+ <SankeyDiagram
125
+ data="simple_sankey"
126
+ sourceCol=source
127
+ targetCol=target
128
+ valueCol=amount
129
+ percentCol=percent
130
+ valueFmt=usd
131
+ linkLabels=full
132
+ />
133
+ ```
134
+
135
+ ### `linkLabels=value`
136
+
137
+ ```svelte
138
+ <SankeyDiagram
139
+ data="simple_sankey"
140
+ sourceCol=source
141
+ targetCol=target
142
+ valueCol=amount
143
+ percentCol=percent
144
+ valueFmt=usd
145
+ linkLabels=value
146
+ />
147
+ ```
148
+
149
+ ### `linkLabels=percent`
150
+
151
+ ```svelte
152
+ <SankeyDiagram
153
+ data="simple_sankey"
154
+ sourceCol=source
155
+ targetCol=target
156
+ valueCol=amount
157
+ percentCol=percent
158
+ valueFmt=usd
159
+ linkLabels=percent
160
+ />
161
+ ```
162
+
163
+ ## Custom Color Palette
164
+
165
+ ```svelte
166
+ <SankeyDiagram
167
+ data="simple_sankey"
168
+ sourceCol=source
169
+ targetCol=target
170
+ valueCol=amount
171
+ percentCol=percent
172
+ linkColor=base-content-muted
173
+ colorPalette={['#ad4940', '#3d8cc4', '#1b5218', '#ebb154']}
174
+ />
175
+ ```
176
+
177
+ ## Link Colors
178
+
179
+ ### `linkColor=base-content-muted` (default)
180
+
181
+ ```svelte
182
+ <SankeyDiagram
183
+ data="simple_sankey"
184
+ sourceCol=source
185
+ targetCol=target
186
+ valueCol=amount
187
+ percentCol=percent
188
+ linkColor=base-content-muted
189
+ colorPalette={['#ad4940', '#3d8cc4', '#1b5218', '#ebb154']}
190
+ />
191
+ ```
192
+
193
+ ### `linkColor=source`
194
+
195
+ ```svelte
196
+ <SankeyDiagram
197
+ data="simple_sankey"
198
+ sourceCol=source
199
+ targetCol=target
200
+ valueCol=amount
201
+ percentCol=percent
202
+ linkColor=source
203
+ colorPalette={['#ad4940', '#3d8cc4', '#1b5218', '#ebb154']}
204
+ />
205
+ ```
206
+
207
+ ### `linkColor=target`
208
+
209
+ ```svelte
210
+ <SankeyDiagram
211
+ data="simple_sankey"
212
+ sourceCol=source
213
+ targetCol=target
214
+ valueCol=amount
215
+ percentCol=percent
216
+ linkColor=target
217
+ colorPalette={['#ad4940', '#3d8cc4', '#1b5218', '#ebb154']}
218
+ />
219
+ ```
220
+
221
+ ### `linkColor=gradient`
222
+
223
+ ```svelte
224
+ <SankeyDiagram
225
+ data="simple_sankey"
226
+ sourceCol=source
227
+ targetCol=target
228
+ valueCol=amount
229
+ percentCol=percent
230
+ linkColor=gradient
231
+ colorPalette={['#6e0e08', '#3d8cc4', '#1b5218', '#ebb154']}
232
+ />
233
+ ```
234
+
235
+ ## Multi-level
236
+
237
+ The syntax for multi-level sankey diagrams is the same, but the
238
+ underlying query must represent all the levels using the same
239
+ `sourceCol` and `targetCol`, so it is necessary to `union`
240
+ each level together. `sourceCol` nodes on the next level will be linked to `targetCol` nodes in the previous level with the same name.
241
+
242
+ For example, here is the source for the visuals above.
243
+
244
+ ```svelte
245
+ <SankeyDiagram
246
+ data="traffic_data"
247
+ title="Sankey"
248
+ subtitle="A simple sankey chart"
249
+ sourceCol=source
250
+ targetCol=target
251
+ valueCol=count
252
+ />
253
+ ```
254
+
255
+ ## Options
256
+
257
+ ### Data
258
+
259
+ | Name | Description | Required | Options | Default |
260
+ |------|-------------|----------|---------|---------|
261
+ | data | Query name, wrapped in curly braces | true | query name | - |
262
+ | sourceCol | Column to use for the source of the diagram | true | column name | - |
263
+ | targetCol | Column to use for the target of the diagram | true | column name | - |
264
+ | valueCol | Column to use for the value of the diagram | true | column name | - |
265
+ | percentCol | Column to use for the percent labels of the diagram | false | column name | - |
266
+ | depthOverride | Manual adjustment to location of each node `{{'services revenue': 2}}` | false | object containing node name and depth level (0 is first level) | - |
267
+ | 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" |
268
+ | 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" |
269
+ | printEchartsConfig | Helper prop for custom chart development - inserts a code block with the current echarts config onto the page so you can see the options used and debug your custom options | false | ['true', 'false'] | "false" |
270
+
271
+ ### Formatting & Styling
272
+
273
+ | Name | Description | Required | Options | Default |
274
+ |------|-------------|----------|---------|---------|
275
+ | valueFmt | Format to use for `valueCol` ([see available formats](/core-concepts/formatting)) | false | Excel-style format \| built-in format \| custom format | - |
276
+ | orient | Layout direction of the nodes in the diagram. | false | ['horizontal', 'vertical'] | "horizontal" |
277
+ | sort | Whether the nodes are sorted by size in the diagram | false | ['true', 'false'] | "false" |
278
+ | nodeAlign | Controls the horizontal alignment of nodes in the diagram. When orient is vertical, nodeAlign controls vertical alignment. | false | ['justify', 'left', 'right'] | "justify" |
279
+ | nodeGap | The gap between any two rectangles in each column of the the diagram. | false | number | 8 |
280
+ | nodeWidth | The node width of rectangle in the diagram. | false | number | 20 |
281
+ | outlineColor | Border color. Only accepts a single color. | false | CSS name \| hexademical \| RGB \| HSL | "transparent" |
282
+ | outlineWidth | Border Width. It should be a natural number. | false | number | 1 |
283
+ | colorPalette | Array of custom colours to use for the chart. E.g., `{['#cf0d06','#eb5752','#e88a87']}` | false | array of color strings (CSS name \| hexademical \| RGB \| HSL) | built-in color palette |
284
+ | linkColor | Color to use for the links between nodes in the diagram | false | ['base-content-muted', 'source', 'target', 'gradient'] | "base-content-muted" |
285
+
286
+ ### Chart
287
+
288
+ | Name | Description | Required | Options | Default |
289
+ |------|-------------|----------|---------|---------|
290
+ | title | Chart title. Appears at top left of chart. | false | string | - |
291
+ | subtitle | Chart subtitle. Appears just under title. | false | string | - |
292
+ | nodeLabels | Adds labels to the nodes of the diagram | false | ['name', 'value', 'full'] | "name" |
293
+ | linkLabels | Adds labels to the links between nodes | false | ['full', 'value', 'percent'] | "full (requires percentCol)" |
294
+ | 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 |
295
+
296
+ ### Custom Echarts Options
297
+
298
+ | Name | Description | Required | Options | Default |
299
+ |------|-------------|----------|---------|---------|
300
+ | echartsOptions | Custom Echarts options to override the default options. See [reference page](/components/charts/echarts-options) for available options. | false | `{{exampleOption:'exampleValue'}}` | - |
301
+ | printEchartsConfig | Helper prop for custom chart development - inserts a code block with the current echarts config onto the page so you can see the options used and debug your custom options | false | ['true', 'false'] | "false" |
@@ -0,0 +1,134 @@
1
+ ---
2
+ title: Scatter Plot
3
+ description: Show the correlation between two metrics for categorical values, or a set of samples.
4
+ ---
5
+
6
+ Use scatter plots to show the correlation between two metrics for categorical values, or a set of samples.
7
+
8
+ ## Example
9
+
10
+ ```markdown
11
+ <ScatterPlot
12
+ data="price_vs_volume"
13
+ x=price
14
+ y=number_of_units
15
+ xFmt=usd0
16
+ series=category
17
+ />
18
+ ```
19
+
20
+ ## Examples
21
+
22
+ ### Default
23
+
24
+ ```markdown
25
+ <ScatterPlot
26
+ data="price_vs_volume"
27
+ x=price
28
+ y=number_of_units
29
+ />
30
+ ```
31
+
32
+ ### Multi-Series
33
+
34
+ ```markdown
35
+ <ScatterPlot
36
+ data="price_vs_volume"
37
+ x=price
38
+ y=number_of_units
39
+ series=category
40
+ />
41
+ ```
42
+
43
+ ## Options
44
+
45
+ ### Data
46
+
47
+ | Name | Description | Required | Options | Default |
48
+ |------|-------------|----------|---------|---------|
49
+ | data | Query name, wrapped in curly braces | true | query name | - |
50
+ | x | Column to use for the x-axis of the chart | true | column name | First column |
51
+ | y | Column(s) to use for the y-axis of the chart | true | column name \| array of column names | Any non-assigned numeric columns |
52
+ | series | Column to use as the series (groups) in a multi-series chart | false | column name | - |
53
+ | 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" |
54
+ | tooltipTitle | Column to use as the title for each tooltip. Typically, this is a name to identify each point. | false | column name | - |
55
+ | 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" |
56
+ | 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" |
57
+
58
+ ### Formatting & Styling
59
+
60
+ | Name | Description | Required | Options | Default |
61
+ |------|-------------|----------|---------|---------|
62
+ | xFmt | Format to use for x column ([see available formats](/core-concepts/formatting)) | false | Excel-style format \| built-in format name \| custom format name | - |
63
+ | yFmt | Format to use for y column ([see available formats](/core-concepts/formatting)) | false | Excel-style format \| built-in format name \| custom format name | - |
64
+ | seriesLabelFmt | Format to use for series label ([see available formats](/core-concepts/formatting)) | false | Excel-style format \| built-in format name \| custom format name | "-" |
65
+ | shape | Options for which shape to use for scatter points | false | circle \| emptyCircle \| rect \| triangle \| diamond | "circle" |
66
+ | pointSize | Change size of all points on the chart | false | number | 10 |
67
+ | opacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | 0.7 |
68
+ | fillColor | Color to override default series color. Only accepts a single color. | false | CSS name \| hexademical \| RGB \| HSL | - |
69
+ | outlineWidth | Width of line surrounding each shape | false | number | 0 |
70
+ | outlineColor | Color to use for outline if outlineWidth > 0 | false | CSS name \| hexademical \| RGB \| HSL | - |
71
+ | colorPalette | Array of custom colours to use for the chart. E.g., `{['#cf0d06','#eb5752','#e88a87']}` | false | array of color strings (CSS name \| hexademical \| RGB \| HSL) | built-in color palette |
72
+ | seriesColors | Apply a specific color to each series in your chart. Unspecified series will receive colors from the built-in palette as normal. Note the double curly braces required in the syntax `seriesColors={{"Canada": "red", "US": "blue"}}` | false | object with series names and assigned colors | colors applied by order of series in data |
73
+ | seriesOrder | Apply a specific order to the series in a multi-series chart. | false | Array of series names in the order they should be used in the chart seriesOrder="`{['series one', 'series two']"`} | default order implied by the data |
74
+ | leftPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | false | number | - |
75
+ | rightPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | false | number | - |
76
+ | xLabelWrap | Whether to wrap x-axis labels when there is not enough space. Default behaviour is to truncate the labels. | false | ["true", "false"] | "false" |
77
+
78
+ ### Axes
79
+
80
+ | Name | Description | Required | Options | Default |
81
+ |------|-------------|----------|---------|---------|
82
+ | yLog | Whether to use a log scale for the y-axis | false | ['true', 'false'] | 'false' |
83
+ | yLogBase | Base to use when log scale is enabled | false | 'number' | '10' |
84
+ | xAxisTitle | Name to show under x-axis. If 'true', formatted column name is used. Only works with swapXY=false | false | 'true \| string \| false' | 'true' |
85
+ | yAxisTitle | Name to show beside y-axis. If 'true', formatted column name is used. | false | 'true \| string \| false' | 'true' |
86
+ | xGridlines | Turns on/off gridlines extending from x-axis tick marks (vertical lines when swapXY=false) | false | ['true', 'false'] | 'false' |
87
+ | yGridlines | Turns on/off gridlines extending from y-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
+ | xBaseline | Turns on/off thick axis line (line appears at y=0) | false | ['true', 'false'] | 'true' |
91
+ | yBaseline | Turns on/off thick axis line (line appears directly alongside the y-axis labels) | false | ['true', 'false'] | 'false' |
92
+ | xTickMarks | Turns on/off tick marks for each of the x-axis labels | false | ['true', 'false'] | 'false' |
93
+ | yTickMarks | Turns on/off tick marks for each of the y-axis labels | false | ['true', 'false'] | 'false' |
94
+ | xMin | Starting value for the x-axis | false | 'number' | - |
95
+ | xMax | Maximum value for the x-axis | false | 'number' | - |
96
+ | yMin | Starting value for the y-axis | false | 'number' | - |
97
+ | yMax | Maximum value for the y-axis | false | 'number' | - |
98
+
99
+ ### Chart
100
+
101
+ | Name | Description | Required | Options | Default |
102
+ |------|-------------|----------|---------|---------|
103
+ | title | Chart title. Appears at top left of chart. | false | 'string' | - |
104
+ | subtitle | Chart subtitle. Appears just under title. | false | 'string' | - |
105
+ | legend | Turns legend on or off. Legend appears at top center of chart. | false | ['true', 'false'] | 'true for multiple series' |
106
+ | 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' |
107
+ | 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' |
108
+ | downloadableData | Whether to show the download button to allow users to download the data | false | ["true", "false"] | "true" |
109
+ | downloadableImage | Whether to show the button to allow users to save the chart as an image | false | ["true", "false"] | "true" |
110
+
111
+ ### Custom Echarts Options
112
+
113
+ | Name | Description | Required | Options | Default |
114
+ |------|-------------|----------|---------|---------|
115
+ | echartsOptions | Custom Echarts options to override the default options. See [reference page](/components/charts/echarts-options) for available options. | false | `{{exampleOption:'exampleValue'}}` | - |
116
+ | seriesOptions | Custom Echarts options to override the default options for all series in the chart. This loops through the series to apply the settings rather than having to specify every series manually using `echartsOptions` See [reference page](/components/charts/echarts-options) for available options. | false | `{{exampleSeriesOption:'exampleValue'}}` | - |
117
+ | printEchartsConfig | Helper prop for custom chart development - inserts a code block with the current echarts config onto the page so you can see the options used and debug your custom options | false | ['true', 'false'] | "false" |
118
+
119
+ ### Interactivity
120
+
121
+ | Name | Description | Required | Options | Default |
122
+ |------|-------------|----------|---------|---------|
123
+ | connectGroup | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected | false | - | - |
124
+
125
+ ## Annotations
126
+
127
+ Scatter plots can include [annotations](/components/charts/annotations) using the `ReferenceLine` and `ReferenceArea` components. These components are used within a chart component like so:
128
+
129
+ ```html
130
+ <ScatterPlot data="sales_data" x=date y=sales>
131
+ <ReferenceLine data="target_data" y=target label=name/>
132
+ <ReferenceArea xMin='2020-03-14' xMax='2020-05-01'/>
133
+ </ScatterPlot>
134
+ ```