@graphenedata/cli 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.ts +7 -43
- package/dist/cli/cli.js +529 -293
- package/dist/docs/graphene.md +924 -63
- package/dist/ui/component-utilities/echarts.js +3 -1
- package/dist/ui/component-utilities/themeStores.ts +35 -7
- package/dist/ui/components/AreaChart.svelte +2 -1
- package/dist/ui/components/BarChart.svelte +2 -1
- package/dist/ui/components/BigValue.svelte +1 -1
- package/dist/ui/components/Chart.svelte +10 -1
- package/dist/ui/components/ECharts.svelte +2 -0
- package/dist/ui/components/LineChart.svelte +2 -1
- package/dist/ui/components/PieChart.svelte +1 -1
- package/dist/ui/components/QueryLoad.svelte +5 -6
- package/dist/ui/components/TableRow.svelte +1 -1
- package/dist/ui/components/_Table.svelte +2 -0
- package/dist/ui/internal/queryEngine.ts +16 -13
- package/dist/ui/internal/telemetry.ts +5 -3
- package/dist/ui/web.js +26 -11
- package/package.json +2 -1
- package/dist/docs/data_apps/components/charts/annotations.md +0 -673
- package/dist/docs/data_apps/components/charts/area-chart.md +0 -202
- package/dist/docs/data_apps/components/charts/bar-chart.md +0 -317
- package/dist/docs/data_apps/components/charts/box-plot.md +0 -190
- package/dist/docs/data_apps/components/charts/bubble-chart.md +0 -151
- package/dist/docs/data_apps/components/charts/calendar-heatmap.md +0 -112
- package/dist/docs/data_apps/components/charts/custom-echarts.md +0 -308
- package/dist/docs/data_apps/components/charts/echarts-options.md +0 -217
- package/dist/docs/data_apps/components/charts/funnel-chart.md +0 -106
- package/dist/docs/data_apps/components/charts/heatmap.md +0 -180
- package/dist/docs/data_apps/components/charts/histogram.md +0 -107
- package/dist/docs/data_apps/components/charts/line-chart.md +0 -265
- package/dist/docs/data_apps/components/charts/mixed-type-charts.md +0 -240
- package/dist/docs/data_apps/components/charts/sankey-diagram.md +0 -301
- package/dist/docs/data_apps/components/charts/scatter-plot.md +0 -134
- package/dist/docs/data_apps/components/charts/sparkline.md +0 -68
- package/dist/docs/data_apps/components/data/big-value.md +0 -153
- package/dist/docs/data_apps/components/data/delta.md +0 -89
- package/dist/docs/data_apps/components/data/table.md +0 -470
- package/dist/docs/data_apps/components/data/value.md +0 -97
- package/dist/docs/data_apps/components/inputs/button-group.md +0 -154
- package/dist/docs/data_apps/components/inputs/checkbox.md +0 -52
- package/dist/docs/data_apps/components/inputs/date-input.md +0 -131
- package/dist/docs/data_apps/components/inputs/date-range.md +0 -124
- package/dist/docs/data_apps/components/inputs/dimension-grid.md +0 -67
- package/dist/docs/data_apps/components/inputs/dropdown.md +0 -199
- package/dist/docs/data_apps/components/inputs/index.md +0 -3
- package/dist/docs/data_apps/components/inputs/slider.md +0 -126
- package/dist/docs/data_apps/components/inputs/text-input.md +0 -86
- package/dist/docs/data_apps/components/maps/area-map.md +0 -397
- package/dist/docs/data_apps/components/maps/base-map.md +0 -269
- package/dist/docs/data_apps/components/maps/bubble-map.md +0 -361
- package/dist/docs/data_apps/components/maps/point-map.md +0 -326
- package/dist/docs/data_apps/components/maps/us-map.md +0 -167
- package/dist/docs/data_apps/components/ui/accordion.md +0 -116
- package/dist/docs/data_apps/components/ui/alert.md +0 -37
- package/dist/docs/data_apps/components/ui/big-link.md +0 -19
- package/dist/docs/data_apps/components/ui/details.md +0 -58
- package/dist/docs/data_apps/components/ui/download-data.md +0 -41
- package/dist/docs/data_apps/components/ui/embed.md +0 -47
- package/dist/docs/data_apps/components/ui/grid.md +0 -45
- package/dist/docs/data_apps/components/ui/image.md +0 -61
- package/dist/docs/data_apps/components/ui/info.md +0 -47
- package/dist/docs/data_apps/components/ui/last-refreshed.md +0 -28
- package/dist/docs/data_apps/components/ui/link-button.md +0 -20
- package/dist/docs/data_apps/components/ui/link.md +0 -40
- package/dist/docs/data_apps/components/ui/modal.md +0 -57
- package/dist/docs/data_apps/components/ui/note.md +0 -32
- package/dist/docs/data_apps/components/ui/print-format-components.md +0 -85
- package/dist/docs/data_apps/components/ui/tabs.md +0 -122
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Heatmap
|
|
3
|
-
description: Show patterns in a single metric across two categorical dimensions, using colour to indicate size.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Use heatmaps to show patterns in a single metric across two categorical dimensions, using colour to indicate size.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**Example:**
|
|
10
|
-
|
|
11
|
-
```markdown
|
|
12
|
-
<Heatmap
|
|
13
|
-
data="orders"
|
|
14
|
-
x=day
|
|
15
|
-
y=category
|
|
16
|
-
value=order_count
|
|
17
|
-
valueFmt=usd
|
|
18
|
-
/>
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Data Structure
|
|
22
|
-
|
|
23
|
-
Heatmap requires your data to contain 2 categorical columns (1 for the x-axis and 1 for the y-axis) and 1 numeric column.
|
|
24
|
-
|
|
25
|
-
#### Example
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
| region | product | sales |
|
|
29
|
-
|--------|---------|-------|
|
|
30
|
-
| {example.region} | {example.product} | {example.sales} |
|
|
31
|
-
|
|
32
|
-
### Unpivoting your Data
|
|
33
|
-
If you have data spread across columns, you can use the `UNPIVOT` feature in your SQL query to prepare the data for the heatmap.
|
|
34
|
-
|
|
35
|
-
#### Example
|
|
36
|
-
If you have a query result called `region_sales`:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
| region | A | B | C |
|
|
40
|
-
|--------|---|---|---|
|
|
41
|
-
| {region_sales.region} | {region_sales.A} | {region_sales.B} | {region_sales.C} |
|
|
42
|
-
|
|
43
|
-
You can use `UNPIVOT` like so:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Which will return this table, which can be passed into the Heatmap:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
| region | product | sales |
|
|
50
|
-
|--------|---------|-------|
|
|
51
|
-
| {region_sales_unpivoted.region} | {region_sales_unpivoted.product} | {region_sales_unpivoted.sales} |
|
|
52
|
-
|
|
53
|
-
> **Note on Date Columns**
|
|
54
|
-
>
|
|
55
|
-
> Heatmap currently only works with string columns. If you would like to use a date column, cast it to a string in your SQL query before passing it into the Heatmap
|
|
56
|
-
|
|
57
|
-
## Examples
|
|
58
|
-
|
|
59
|
-
### Basic Heatmap
|
|
60
|
-
|
|
61
|
-
**Example:**
|
|
62
|
-
|
|
63
|
-
```markdown
|
|
64
|
-
<Heatmap
|
|
65
|
-
data="orders"
|
|
66
|
-
x=day
|
|
67
|
-
y=category
|
|
68
|
-
value=order_count
|
|
69
|
-
valueFmt=usd
|
|
70
|
-
/>
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Custom Color Scale
|
|
74
|
-
|
|
75
|
-
**Example:**
|
|
76
|
-
|
|
77
|
-
```svelte
|
|
78
|
-
<Heatmap
|
|
79
|
-
data="orders"
|
|
80
|
-
x=day
|
|
81
|
-
y=category
|
|
82
|
-
value=order_count
|
|
83
|
-
valueFmt=usd
|
|
84
|
-
colorScale="[
|
|
85
|
-
['rgb(254,234,159)', 'rgb(254,234,159)'],
|
|
86
|
-
['rgb(218,66,41)', 'rgb(218,66,41)']
|
|
87
|
-
]"
|
|
88
|
-
/>
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Rotated Labels
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
**Example:**
|
|
95
|
-
|
|
96
|
-
```svelte
|
|
97
|
-
<Heatmap
|
|
98
|
-
data="item_state"
|
|
99
|
-
x=item
|
|
100
|
-
y=state
|
|
101
|
-
value=orders
|
|
102
|
-
xLabelRotation=-45
|
|
103
|
-
colorScale={['white', 'maroon']}
|
|
104
|
-
title="Item Sales"
|
|
105
|
-
subtitle="By State"
|
|
106
|
-
rightPadding=40
|
|
107
|
-
cellHeight=25
|
|
108
|
-
nullsZero=false
|
|
109
|
-
/>
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Options
|
|
113
|
-
|
|
114
|
-
### Data
|
|
115
|
-
|
|
116
|
-
| Property | Required | Type | Default | Description |
|
|
117
|
-
|----------|----------|------|---------|-------------|
|
|
118
|
-
| data | ✓ | query name | | Query name, wrapped in curly braces |
|
|
119
|
-
| x | ✓ | column name | | Categorical column to use for the x-axis. If you want to use dates, cast them to strings in your query first |
|
|
120
|
-
| y | ✓ | column name | | Categorical column to use for the y-axis. If you want to use dates, cast them to strings in your query first |
|
|
121
|
-
| value | ✓ | column name | | Numeric column to use for the y-axis |
|
|
122
|
-
| min | | number | min of value column | Minimum number for the heatmap's color scale |
|
|
123
|
-
| max | | number | max of value column | Maximum number for the heatmap's color scale |
|
|
124
|
-
| emptySet | | error/warn/pass | error | 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. |
|
|
125
|
-
| emptyMessage | | string | "No records" | 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.). |
|
|
126
|
-
|
|
127
|
-
### Formatting & Styling
|
|
128
|
-
|
|
129
|
-
| Property | Type | Default | Description |
|
|
130
|
-
|----------|------|---------|-------------|
|
|
131
|
-
| nullsZero | true/false | true | Whether to treats nulls or missing values as zero |
|
|
132
|
-
| zeroDisplay | string | | String to display in place of zeros |
|
|
133
|
-
| colorScale | array of color codes - e.g., `{['navy', 'white', '#c9c9c9']}` | | Array of colors to form the gradient for the heatmap. |
|
|
134
|
-
| valueFmt | Excel-style format \| built-in format name \| custom format name | | Format to use for value column ([see available formats](/core-concepts/formatting)) |
|
|
135
|
-
| cellHeight | number | 30 | Number representing the height of cells in the heatmap |
|
|
136
|
-
| leftPadding | number | 0 | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off |
|
|
137
|
-
| rightPadding | number | 2 | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off |
|
|
138
|
-
| valueLabels | true/false | true | Turn on or off value labels in the heatmap cells |
|
|
139
|
-
| mobileValueLabels | true/false | false | Turn on or off value labels in the heatmap cells when app is viewed on a mobile device screen size |
|
|
140
|
-
| borders | true/false | true | Turn on or off borders around cells. Default is to show light grey border around each cell. To customize border appearance, use `echartsOptions` |
|
|
141
|
-
|
|
142
|
-
### Axes
|
|
143
|
-
|
|
144
|
-
| Property | Type | Default | Description |
|
|
145
|
-
|----------|------|---------|-------------|
|
|
146
|
-
| xTickMarks | true/false | false | Turns on/off tick marks for the x-axis labels |
|
|
147
|
-
| yTickMarks | true/false | false | Turns on/off tick marks for the y-axis labels |
|
|
148
|
-
| xLabelRotation | number | 0 | Degrees to rotate the labels on the x-axis. Can be negative number to reverse direction. `45` and `-45` are common options |
|
|
149
|
-
| xAxisPosition | top/bottom | top | Position of x-axis and labels. Can be top or bottom. top recommended for longer charts |
|
|
150
|
-
| xSort | column name | | Column to sort x values by |
|
|
151
|
-
| xSortOrder | asc/desc | asc | Sets direction of sort |
|
|
152
|
-
| ySort | column name | | Column to sort y values by |
|
|
153
|
-
| ySortOrder | asc/desc | asc | Sets direction of sort |
|
|
154
|
-
|
|
155
|
-
### Chart
|
|
156
|
-
|
|
157
|
-
| Property | Type | Default | Description |
|
|
158
|
-
|----------|------|---------|-------------|
|
|
159
|
-
| title | string | | Chart title. Appears at top left of chart. |
|
|
160
|
-
| subtitle | string | | Chart subtitle. Appears just under title. |
|
|
161
|
-
| chartAreaHeight | number | auto set based on y-axis values | 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. |
|
|
162
|
-
| legend | true/false | true | Turn on or off the legend |
|
|
163
|
-
| filter | true/false | false | Allow draggable filtering on the legend. Must be used with `legend=true` |
|
|
164
|
-
| renderer | canvas/svg | canvas | 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/). |
|
|
165
|
-
| downloadableData | true/false | true | Whether to show the download button to allow users to download the data |
|
|
166
|
-
| downloadableImage | true/false | true | Whether to show the button to allow users to save the chart as an image |
|
|
167
|
-
|
|
168
|
-
### Custom Echarts Options
|
|
169
|
-
|
|
170
|
-
| Property | Type | Default | Description |
|
|
171
|
-
|----------|------|---------|-------------|
|
|
172
|
-
| echartsOptions | `{{exampleOption:'exampleValue'}}` | | Custom Echarts options to override the default options. See [reference page](/components/charts/echarts-options) for available options. |
|
|
173
|
-
| seriesOptions | `{{exampleSeriesOption:'exampleValue'}}` | | 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. |
|
|
174
|
-
| printEchartsConfig | true/false | false | 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 |
|
|
175
|
-
|
|
176
|
-
### Interactivity
|
|
177
|
-
|
|
178
|
-
| Property | Type | Description |
|
|
179
|
-
|----------|------|-------------|
|
|
180
|
-
| connectGroup | | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected |
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Histogram
|
|
3
|
-
description: Display the distribution of a metric along a continuous range, aggregated into buckets.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Use histograms to display the distribution of a metric along a continuous range, aggregated into buckets.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**Example:**
|
|
10
|
-
|
|
11
|
-
```markdown
|
|
12
|
-
<Histogram
|
|
13
|
-
data="orders"
|
|
14
|
-
x=sales
|
|
15
|
-
/>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Examples
|
|
19
|
-
|
|
20
|
-
### Histogram
|
|
21
|
-
|
|
22
|
-
**Example:**
|
|
23
|
-
|
|
24
|
-
```markdown
|
|
25
|
-
<Histogram
|
|
26
|
-
data="orders_week"
|
|
27
|
-
x=sales
|
|
28
|
-
xAxisTitle="Weekly Sales"
|
|
29
|
-
/>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Options
|
|
33
|
-
|
|
34
|
-
### Data
|
|
35
|
-
|
|
36
|
-
| Property | Required | Type | Default | Description |
|
|
37
|
-
|----------|----------|------|---------|-------------|
|
|
38
|
-
| data | ✓ | query name | | Query name, wrapped in curly braces |
|
|
39
|
-
| x | ✓ | column name | | Column which contains the data you want to summarize |
|
|
40
|
-
| emptySet | | error/warn/pass | error | 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. |
|
|
41
|
-
| emptyMessage | | string | "No records" | 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.). |
|
|
42
|
-
|
|
43
|
-
### Formatting & Styling
|
|
44
|
-
|
|
45
|
-
| Property | Type | Default | Description |
|
|
46
|
-
|----------|------|---------|-------------|
|
|
47
|
-
| xFmt | Excel-style format \| built-in format name \| custom format name | | Format to use for x column ([see available formats](/core-concepts/formatting)) |
|
|
48
|
-
| fillColor | CSS name \| hexademical \| RGB \| HSL | | Color to override default series color |
|
|
49
|
-
| fillOpacity | number (0 to 1) | 1 | % of the full color that should be rendered, with remainder being transparent |
|
|
50
|
-
| colorPalette | array of color strings (CSS name \| hexademical \| RGB \| HSL) | built-in color palette | Array of custom colours to use for the chart. E.g., `{['#cf0d06','#eb5752','#e88a87']}` |
|
|
51
|
-
| leftPadding | number | | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off |
|
|
52
|
-
| rightPadding | number | | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off |
|
|
53
|
-
| xLabelWrap | true/false | false | Whether to wrap x-axis labels when there is not enough space. Default behaviour is to truncate the labels. |
|
|
54
|
-
|
|
55
|
-
### Axes
|
|
56
|
-
|
|
57
|
-
| Property | Type | Default | Description |
|
|
58
|
-
|----------|------|---------|-------------|
|
|
59
|
-
| xAxisTitle | true/string/false | false | Name to show under x-axis. If 'true', formatted column name is used. Only works with swapXY=false |
|
|
60
|
-
| yAxisTitle | true/string/false | false | Name to show beside y-axis. If 'true', formatted column name is used. |
|
|
61
|
-
| xGridlines | true/false | false | Turns on/off gridlines extending from x-axis tick marks (vertical lines when swapXY=false) |
|
|
62
|
-
| yGridlines | true/false | true | Turns on/off gridlines extending from y-axis tick marks (horizontal lines when swapXY=false) |
|
|
63
|
-
| xAxisLabels | true/false | true | Turns on/off value labels on the x-axis |
|
|
64
|
-
| yAxisLabels | true/false | true | Turns on/off value labels on the y-axis |
|
|
65
|
-
| xBaseline | true/false | true | Turns on/off thick axis line (line appears at y=0) |
|
|
66
|
-
| yBaseline | true/false | false | Turns on/off thick axis line (line appears directly alongside the y-axis labels) |
|
|
67
|
-
| xTickMarks | true/false | false | Turns on/off tick marks for each of the x-axis labels |
|
|
68
|
-
| yTickMarks | true/false | false | Turns on/off tick marks for each of the y-axis labels |
|
|
69
|
-
| yMin | number | | Starting value for the y-axis |
|
|
70
|
-
| yMax | number | | Maximum value for the y-axis |
|
|
71
|
-
|
|
72
|
-
### Chart
|
|
73
|
-
|
|
74
|
-
| Property | Type | Default | Description |
|
|
75
|
-
|----------|------|---------|-------------|
|
|
76
|
-
| title | string | | Chart title. Appears at top left of chart. |
|
|
77
|
-
| subtitle | string | | Chart subtitle. Appears just under title. |
|
|
78
|
-
| legend | true/false | true for multiple series | Turns legend on or off. Legend appears at top center of chart. |
|
|
79
|
-
| chartAreaHeight | number | 180 | 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. |
|
|
80
|
-
| renderer | canvas/svg | canvas | 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/). |
|
|
81
|
-
| downloadableData | true/false | true | Whether to show the download button to allow users to download the data |
|
|
82
|
-
| downloadableImage | true/false | true | Whether to show the button to allow users to save the chart as an image |
|
|
83
|
-
|
|
84
|
-
### Custom Echarts Options
|
|
85
|
-
|
|
86
|
-
| Property | Type | Default | Description |
|
|
87
|
-
|----------|------|---------|-------------|
|
|
88
|
-
| echartsOptions | `{{exampleOption:'exampleValue'}}` | | Custom Echarts options to override the default options. See [reference page](/components/charts/echarts-options) for available options. |
|
|
89
|
-
| seriesOptions | `{{exampleSeriesOption:'exampleValue'}}` | | 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. |
|
|
90
|
-
| printEchartsConfig | true/false | false | 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 |
|
|
91
|
-
|
|
92
|
-
### Interactivity
|
|
93
|
-
|
|
94
|
-
| Property | Type | Description |
|
|
95
|
-
|----------|------|-------------|
|
|
96
|
-
| connectGroup | | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected |
|
|
97
|
-
|
|
98
|
-
## Annotations
|
|
99
|
-
|
|
100
|
-
Histograms can include [annotations](/components/charts/annotations) using the `ReferenceLine` and `ReferenceArea` components. These components are used within a chart component like so:
|
|
101
|
-
|
|
102
|
-
```html
|
|
103
|
-
<Histogram data="sales_data" x=category>
|
|
104
|
-
<ReferenceLine y=20/>
|
|
105
|
-
<ReferenceArea xMin=3 xMax=8/>
|
|
106
|
-
</Histogram>
|
|
107
|
-
```
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Line Chart
|
|
3
|
-
description: 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.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
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.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Example
|
|
10
|
-
|
|
11
|
-
```svelte
|
|
12
|
-
<LineChart
|
|
13
|
-
data="orders_by_month"
|
|
14
|
-
x=month
|
|
15
|
-
y=sales_usd0k
|
|
16
|
-
yAxisTitle="Sales per Month"
|
|
17
|
-
/>
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Examples
|
|
21
|
-
|
|
22
|
-
### Line
|
|
23
|
-
|
|
24
|
-
```svelte
|
|
25
|
-
<LineChart
|
|
26
|
-
data="orders_by_month"
|
|
27
|
-
x=month
|
|
28
|
-
y=sales_usd0k
|
|
29
|
-
yAxisTitle="Sales per Month"
|
|
30
|
-
title="Monthly Sales"
|
|
31
|
-
subtitle="Includes all categories"
|
|
32
|
-
/>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Multi-Series Line
|
|
36
|
-
|
|
37
|
-
```markdown
|
|
38
|
-
<LineChart
|
|
39
|
-
data="orders_by_category"
|
|
40
|
-
x=month
|
|
41
|
-
y=sales_usd0k
|
|
42
|
-
yAxisTitle="Sales per Month"
|
|
43
|
-
series=category
|
|
44
|
-
/>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Multi-Series Line with Steps
|
|
48
|
-
|
|
49
|
-
```svelte
|
|
50
|
-
<LineChart
|
|
51
|
-
data="orders_by_category"
|
|
52
|
-
x=month
|
|
53
|
-
y=sales_usd0k
|
|
54
|
-
yAxisTitle="Sales per Month"
|
|
55
|
-
series=category
|
|
56
|
-
step=true
|
|
57
|
-
/>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Multiple y Columns
|
|
61
|
-
|
|
62
|
-
```svelte
|
|
63
|
-
<LineChart
|
|
64
|
-
data="orders_by_month"
|
|
65
|
-
x=month
|
|
66
|
-
y={['sales_usd0k','orders']}
|
|
67
|
-
yAxisTitle="Sales per Month"
|
|
68
|
-
/>
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Secondary y Axis
|
|
72
|
-
|
|
73
|
-
```markdown
|
|
74
|
-
<LineChart
|
|
75
|
-
data="orders_by_month"
|
|
76
|
-
x=month
|
|
77
|
-
y=sales_usd0k
|
|
78
|
-
y2=orders
|
|
79
|
-
yAxisTitle="Sales per Month"
|
|
80
|
-
/>
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Secondary Axis with Bar
|
|
84
|
-
|
|
85
|
-
```markdown
|
|
86
|
-
<LineChart
|
|
87
|
-
data="orders_by_month"
|
|
88
|
-
x=month
|
|
89
|
-
y=sales_usd0k
|
|
90
|
-
y2=orders
|
|
91
|
-
y2SeriesType=bar
|
|
92
|
-
yAxisTitle="Sales per Month"
|
|
93
|
-
/>
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Value Labels
|
|
97
|
-
|
|
98
|
-
```markdown
|
|
99
|
-
<LineChart
|
|
100
|
-
data="orders_by_month"
|
|
101
|
-
x=month
|
|
102
|
-
y=sales_usd0k
|
|
103
|
-
yAxisTitle="Sales per Month"
|
|
104
|
-
labels=true
|
|
105
|
-
/>
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Custom Color Palette
|
|
109
|
-
|
|
110
|
-
```markdown
|
|
111
|
-
<LineChart
|
|
112
|
-
data="orders_by_category"
|
|
113
|
-
x=month
|
|
114
|
-
y=sales_usd0k
|
|
115
|
-
yAxisTitle="Sales per Month"
|
|
116
|
-
series=category
|
|
117
|
-
colorPalette="
|
|
118
|
-
[
|
|
119
|
-
'#cf0d06',
|
|
120
|
-
'#eb5752',
|
|
121
|
-
'#e88a87',
|
|
122
|
-
'#fcdad9',
|
|
123
|
-
]
|
|
124
|
-
"
|
|
125
|
-
/>
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### Markers
|
|
129
|
-
|
|
130
|
-
#### Default
|
|
131
|
-
|
|
132
|
-
```svelte
|
|
133
|
-
<LineChart
|
|
134
|
-
data="orders_by_month"
|
|
135
|
-
x=month
|
|
136
|
-
y=sales_usd0k
|
|
137
|
-
markers=true
|
|
138
|
-
/>
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
#### `markerShape=emptyCircle`
|
|
142
|
-
|
|
143
|
-
```svelte
|
|
144
|
-
<LineChart
|
|
145
|
-
data="orders_by_month"
|
|
146
|
-
x=month
|
|
147
|
-
y=sales_usd0k
|
|
148
|
-
markers=true
|
|
149
|
-
markerShape=emptyCircle
|
|
150
|
-
/>
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
## Options
|
|
154
|
-
|
|
155
|
-
### Data
|
|
156
|
-
|
|
157
|
-
| Name | Description | Required | Options | Default |
|
|
158
|
-
|------|-------------|----------|---------|---------|
|
|
159
|
-
| data | Query name, wrapped in curly braces | true | query name | - |
|
|
160
|
-
| x | Column to use for the x-axis of the chart | true | column name | - |
|
|
161
|
-
| y | Column(s) to use for the y-axis of the chart | true | column name \| array of column names | - |
|
|
162
|
-
| y2 | Column(s) to include on a secondary y-axis | false | column name \| array of column names | - |
|
|
163
|
-
| y2SeriesType | Chart type to apply to the series on the y2 axis | false | ["line", "bar", "scatter"] | "line" |
|
|
164
|
-
| series | Column to use as the series (groups) in a multi-series chart | false | column name | - |
|
|
165
|
-
| 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" |
|
|
166
|
-
| handleMissing | Treatment of missing values in the dataset | false | ["gap", "connect", "zero"] | "gap" |
|
|
167
|
-
| 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" |
|
|
168
|
-
| 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 | - |
|
|
169
|
-
|
|
170
|
-
### Formatting & Styling
|
|
171
|
-
|
|
172
|
-
| Name | Description | Required | Options | Default |
|
|
173
|
-
|------|-------------|----------|---------|---------|
|
|
174
|
-
| xFmt | Format to use for x column | false | Excel-style format \| built-in format name \| custom format name | - |
|
|
175
|
-
| yFmt | Format to use for y column(s) | false | Excel-style format \| built-in format name \| custom format name | - |
|
|
176
|
-
| y2Fmt | Format to use for y2 column(s) | false | Excel-style format \| built-in format name \| custom format name | - |
|
|
177
|
-
| seriesLabelFmt | Format to use for series label ([see available formats](/core-concepts/formatting)) | false | Excel-style format \| built-in format name \| custom format name | "-" |
|
|
178
|
-
| step | Specifies whether the chart is displayed as a step line | false | ["true", "false"] | "false" |
|
|
179
|
-
| stepPosition | Configures the position of turn points for a step line chart | false | ["start", "middle", "end"] | "end" |
|
|
180
|
-
| lineColor | Color to override default series color. Only accepts a single color | false | CSS name \| hexademical \| RGB \| HSL | - |
|
|
181
|
-
| lineOpacity | % of the full color that should be rendered, with remainder being transparent | false | number (0 to 1) | 1 |
|
|
182
|
-
| lineType | Options to show breaks in a line (dashed or dotted) | false | ["solid", "dashed", "dotted"] | "solid" |
|
|
183
|
-
| lineWidth | Thickness of line (in pixels) | false | number | 2 |
|
|
184
|
-
| markers | Turn on/off markers (shapes rendered onto the points of a line) | false | ["true", "false"] | "false" |
|
|
185
|
-
| markerShape | Shape to use if markers=true | false | ["circle", "emptyCircle", "rect", "triangle", "diamond"] | "circle" |
|
|
186
|
-
| markerSize | Size of each shape (in pixels) | false | number | 8 |
|
|
187
|
-
| 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) | - |
|
|
188
|
-
| 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 | - |
|
|
189
|
-
| 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 |
|
|
190
|
-
| labels | Show value labels | false | ["true", "false"] | "false" |
|
|
191
|
-
| labelSize | Font size of value labels | false | number | 11 |
|
|
192
|
-
| labelPosition | Where label will appear on your series | false | ["above", "middle", "below"] | "above" |
|
|
193
|
-
| labelColor | Font color of value labels | false | CSS name \| hexademical \| RGB \| HSL | - |
|
|
194
|
-
| labelFmt | Format to use for value labels | false | Excel-style format \| built-in format name \| custom format name | - |
|
|
195
|
-
| yLabelFmt | Format to use for value labels for series on the y axis. Overrides any other formats | false | Excel-style format \| built-in format name \| custom format name | - |
|
|
196
|
-
| y2LabelFmt | Format to use for value labels for series on the y2 axis. Overrides any other formats | false | Excel-style format \| built-in format name \| custom format name | - |
|
|
197
|
-
| showAllLabels | Allow all labels to appear on chart, including overlapping labels | false | ["true", "false"] | "false" |
|
|
198
|
-
| leftPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | false | number | - |
|
|
199
|
-
| rightPadding | Number representing the padding (whitespace) on the left side of the chart. Useful to avoid labels getting cut off | false | number | - |
|
|
200
|
-
| xLabelWrap | Whether to wrap x-axis labels when there is not enough space. Default behaviour is to truncate the labels. | false | ["true", "false"] | "false" |
|
|
201
|
-
|
|
202
|
-
### Axes
|
|
203
|
-
|
|
204
|
-
| Name | Description | Required | Options | Default |
|
|
205
|
-
|------|-------------|----------|---------|---------|
|
|
206
|
-
| yLog | Whether to use a log scale for the y-axis | false | ["true", "false"] | "false" |
|
|
207
|
-
| yLogBase | Base to use when log scale is enabled | false | number | 10 |
|
|
208
|
-
| xAxisTitle | Name to show under x-axis. If 'true', formatted column name is used. Only works with swapXY=false | false | ["true", "string", "false"] | "false" |
|
|
209
|
-
| yAxisTitle | Name to show beside y-axis. If 'true', formatted column name is used. | false | ["true", "string", "false"] | "false" |
|
|
210
|
-
| y2AxisTitle | Name to show beside y2 axis. If 'true', formatted column name is used. | false | ["true", "string", "false"] | "false" |
|
|
211
|
-
| xGridlines | Turns on/off gridlines extending from x-axis tick marks (vertical lines when swapXY=false) | false | ["true", "false"] | "false" |
|
|
212
|
-
| yGridlines | Turns on/off gridlines extending from y-axis tick marks (horizontal lines when swapXY=false) | false | ["true", "false"] | "true" |
|
|
213
|
-
| y2Gridlines | Turns on/off gridlines extending from y2-axis tick marks (horizontal lines when swapXY=false) | false | ["true", "false"] | "true" |
|
|
214
|
-
| xAxisLabels | Turns on/off value labels on the x-axis | false | ["true", "false"] | "true" |
|
|
215
|
-
| yAxisLabels | Turns on/off value labels on the y-axis | false | ["true", "false"] | "true" |
|
|
216
|
-
| y2AxisLabels | Turns on/off value labels on the y2-axis | false | ["true", "false"] | "true" |
|
|
217
|
-
| xBaseline | Turns on/off thick axis line (line appears at y=0) | false | ["true", "false"] | "true" |
|
|
218
|
-
| yBaseline | Turns on/off thick axis line (line appears directly alongside the y-axis labels) | false | ["true", "false"] | "false" |
|
|
219
|
-
| y2Baseline | Turns on/off thick axis line (line appears directly alongside the y2-axis labels) | false | ["true", "false"] | "false" |
|
|
220
|
-
| xTickMarks | Turns on/off tick marks for each of the x-axis labels | false | ["true", "false"] | "false" |
|
|
221
|
-
| yTickMarks | Turns on/off tick marks for each of the y-axis labels | false | ["true", "false"] | "false" |
|
|
222
|
-
| y2TickMarks | Turns on/off tick marks for each of the y2-axis labels | false | ["true", "false"] | "false" |
|
|
223
|
-
| yMin | Starting value for the y-axis | false | number | - |
|
|
224
|
-
| yMax | Maximum value for the y-axis | false | number | - |
|
|
225
|
-
| yScale | Whether to scale the y-axis to fit your data. `yMin` and `yMax` take precedence over `yScale` | false | ["true", "false"] | "false" |
|
|
226
|
-
| y2Min | Starting value for the y2-axis | false | number | - |
|
|
227
|
-
| y2Max | Maximum value for the y2-axis | false | number | - |
|
|
228
|
-
| y2Scale | Whether to scale the y-axis to fit your data. `y2Min` and `y2Max` take precedence over `y2Scale` | false | ["true", "false"] | "false" |
|
|
229
|
-
|
|
230
|
-
### Chart
|
|
231
|
-
|
|
232
|
-
| Name | Description | Required | Options | Default |
|
|
233
|
-
|------|-------------|----------|---------|---------|
|
|
234
|
-
| title | Chart title. Appears at top left of chart. | false | string | - |
|
|
235
|
-
| subtitle | Chart subtitle. Appears just under title. | false | string | - |
|
|
236
|
-
| legend | Turn legend on or off. Legend appears at top center of chart. | false | ["true", "false"] | true for multiple series |
|
|
237
|
-
| 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 |
|
|
238
|
-
| 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" |
|
|
239
|
-
| downloadableData | Whether to show the download button to allow users to download the data | false | ["true", "false"] | "true" |
|
|
240
|
-
| downloadableImage | Whether to show the button to allow users to save the chart as an image | false | ["true", "false"] | "true" |
|
|
241
|
-
|
|
242
|
-
### Custom Echarts Options
|
|
243
|
-
|
|
244
|
-
| Name | Description | Required | Options | Default |
|
|
245
|
-
|------|-------------|----------|---------|---------|
|
|
246
|
-
| echartsOptions | Custom Echarts options to override the default options. See [reference page](/components/charts/echarts-options) for available options. | false | `{{exampleOption:'exampleValue'}}` | - |
|
|
247
|
-
| 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'}}` | - |
|
|
248
|
-
| 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" |
|
|
249
|
-
|
|
250
|
-
### Interactivity
|
|
251
|
-
|
|
252
|
-
| Name | Description | Required | Options | Default |
|
|
253
|
-
|------|-------------|----------|---------|---------|
|
|
254
|
-
| connectGroup | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected | false | - | - |
|
|
255
|
-
|
|
256
|
-
## Annotations
|
|
257
|
-
|
|
258
|
-
Line charts can include [annotations](/components/charts/annotations) using the `ReferenceLine` and `ReferenceArea` components. These components are used within a chart component like so:
|
|
259
|
-
|
|
260
|
-
```html
|
|
261
|
-
<LineChart data="sales_data" x="date" y="sales">
|
|
262
|
-
<ReferenceLine data="target_data" y="target" label="name" />
|
|
263
|
-
<ReferenceArea xMin="2020-03-14" xMax="2020-05-01" />
|
|
264
|
-
</LineChart>
|
|
265
|
-
```
|