@graphenedata/cli 0.0.4 → 0.0.6
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 +25 -55
- package/dist/cli/cli.js +1194 -435
- package/dist/docs/graphene.md +1074 -166
- package/dist/ui/component-utilities/echarts.js +3 -1
- package/dist/ui/component-utilities/inputUtils.ts +11 -0
- package/dist/ui/component-utilities/themeStores.ts +35 -7
- package/dist/ui/components/Area.svelte +6 -3
- package/dist/ui/components/AreaChart.svelte +3 -1
- package/dist/ui/components/Bar.svelte +14 -8
- package/dist/ui/components/BarChart.svelte +3 -1
- package/dist/ui/components/BigValue.svelte +1 -1
- package/dist/ui/components/Chart.svelte +57 -101
- package/dist/ui/components/Column.svelte +2 -0
- package/dist/ui/components/ECharts.svelte +2 -0
- package/dist/ui/components/Line.svelte +8 -5
- package/dist/ui/components/LineChart.svelte +3 -2
- 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 +39 -15
- package/dist/ui/internal/telemetry.ts +5 -3
- package/dist/ui/web.js +28 -12
- package/package.json +3 -2
- 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,308 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Custom ECharts
|
|
3
|
-
description: Graphene charts are based on ECharts, a powerful and flexible open source charting library. You can configure any ECharts graph directly using the ECharts component.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Our chart library is based on [ECharts](https://echarts.apache.org/examples/en/index.html), a powerful and flexible open source JavaScript chart library. We use many of the features in ECharts, and combine them with custom data transformation, logic, and theming.
|
|
7
|
-
|
|
8
|
-
## `<ECharts>` Component
|
|
9
|
-
|
|
10
|
-
If you would like to create a fully custom chart, you can use our built-in `<ECharts>` component. This component accepts a JavaScript object containing a chart configuration. To test this out, you can find an example on the [ECharts example page](https://echarts.apache.org/examples/en/index.html) and paste the option object into the Graphene `<ECharts>` component.
|
|
11
|
-
|
|
12
|
-
This will let you create a chart that matches Graphene theming, but gives you access to the [full suite](https://echarts.apache.org/en/option.html#title) of ECharts features.
|
|
13
|
-
|
|
14
|
-
The downside of this approach is that `<ECharts>` requires data to be included in the configuration object, which can be difficult depending on the type of chart you need. If you would like to use specialized ECharts features, but retain the data management you get with Graphene charts, we recommend building a [mixed-type chart](/components/charts/mixed-type-charts) and passing in an `options` object for the specific features you need.
|
|
15
|
-
|
|
16
|
-
## How to Build the Configuration
|
|
17
|
-
|
|
18
|
-
To create a JavaScript object in a Graphene markdown page, you need to add a `<script>` tag. Any objects or variables you create in that script tag are then accessible by the rest of your page using curly braces. For example, if you create a variable named `myVar`, you can show the contents of that variable in your markdown using `{myVar}`.
|
|
19
|
-
|
|
20
|
-
## Examples
|
|
21
|
-
|
|
22
|
-
### Simple Treemap
|
|
23
|
-
|
|
24
|
-
[Link to ECharts example](https://echarts.apache.org/examples/en/editor.html?c=treemap-simple)
|
|
25
|
-
|
|
26
|
-
ECharts requires the data object to have a specific format. For example in the treemap chart show below it expects the columns to be called "name" and "value". The `test_data` query in the code below renames the fields from the original query so ECharts can use them.
|
|
27
|
-
|
|
28
|
-
**Example:**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
````markdown
|
|
33
|
-
<ECharts config="
|
|
34
|
-
{
|
|
35
|
-
title: {
|
|
36
|
-
text: 'Treemap Example',
|
|
37
|
-
left: 'center'
|
|
38
|
-
",
|
|
39
|
-
tooltip: {
|
|
40
|
-
formatter: '{b}: {c}'
|
|
41
|
-
},
|
|
42
|
-
series: [
|
|
43
|
-
{
|
|
44
|
-
type: 'treemap',
|
|
45
|
-
visibleMin: 300,
|
|
46
|
-
label: {
|
|
47
|
-
show: true,
|
|
48
|
-
formatter: '{b}'
|
|
49
|
-
},
|
|
50
|
-
itemStyle: {
|
|
51
|
-
borderColor: '#fff'
|
|
52
|
-
},
|
|
53
|
-
roam: false,
|
|
54
|
-
nodeClick: false,
|
|
55
|
-
data: [...test_data],
|
|
56
|
-
breadcrumb: {
|
|
57
|
-
show: false
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/>
|
|
64
|
-
````
|
|
65
|
-
|
|
66
|
-
### Funnel Chart
|
|
67
|
-
|
|
68
|
-
[Link to ECharts example](https://echarts.apache.org/examples/en/editor.html?c=funnel)
|
|
69
|
-
|
|
70
|
-
ECharts requires the data object to have a specific format. For example in the funnel chart show below it expects the columns to be called "name" and "value". The `funnel_data` query in the code below renames the fields from the original query so ECharts can use them.
|
|
71
|
-
|
|
72
|
-
**Example:**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
````markdown
|
|
77
|
-
<ECharts config="
|
|
78
|
-
{
|
|
79
|
-
tooltip: {
|
|
80
|
-
formatter: '{b": {c}'
|
|
81
|
-
},
|
|
82
|
-
series: [
|
|
83
|
-
{
|
|
84
|
-
type: 'funnel',
|
|
85
|
-
data: [...funnel_data],
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/>
|
|
91
|
-
````
|
|
92
|
-
|
|
93
|
-
### Pie Chart
|
|
94
|
-
|
|
95
|
-
[Link to ECharts example](https://echarts.apache.org/examples/en/editor.html?c=pie-simple)
|
|
96
|
-
|
|
97
|
-
ECharts requires the data object to have a specific format. For example in the pie chart show below it expects the columns to be called "name" and "value". The `pie_data` query in the code below renames the fields from the original query so ECharts can use them.
|
|
98
|
-
|
|
99
|
-
**Example:**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
````markdown
|
|
104
|
-
<ECharts config="
|
|
105
|
-
{
|
|
106
|
-
tooltip: {
|
|
107
|
-
formatter: '{b": {c} ({d}%)'
|
|
108
|
-
},
|
|
109
|
-
series: [
|
|
110
|
-
{
|
|
111
|
-
type: 'pie',
|
|
112
|
-
data: [...pie_data],
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
/>
|
|
118
|
-
````
|
|
119
|
-
|
|
120
|
-
### Donut Chart
|
|
121
|
-
|
|
122
|
-
[Link to ECharts example](https://echarts.apache.org/examples/en/editor.html?c=pie-doughnut)
|
|
123
|
-
|
|
124
|
-
ECharts requires the data object to have a specific format. For example in the donut chart show below it expects the columns to be called "name" and "value". The `donut_data` query in the code below renames the fields from the original query so ECharts can use them.
|
|
125
|
-
|
|
126
|
-
**Example:**
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
````markdown
|
|
131
|
-
<ECharts config="
|
|
132
|
-
{
|
|
133
|
-
tooltip: {
|
|
134
|
-
formatter: '{b": {c} ({d}%)'
|
|
135
|
-
},
|
|
136
|
-
series: [
|
|
137
|
-
{
|
|
138
|
-
type: 'pie',
|
|
139
|
-
radius: ['40%', '70%'],
|
|
140
|
-
data: [...donut_data],
|
|
141
|
-
}
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
/>
|
|
146
|
-
````
|
|
147
|
-
|
|
148
|
-
### Advanced Chart
|
|
149
|
-
|
|
150
|
-
[Link to ECharts example](https://echarts.apache.org/examples/en/editor.html?c=scatter-anscombe-quartet)
|
|
151
|
-
|
|
152
|
-
**Example:**
|
|
153
|
-
|
|
154
|
-
```markdown
|
|
155
|
-
<script>
|
|
156
|
-
const dataAll = [
|
|
157
|
-
[
|
|
158
|
-
[10.0, 8.04],
|
|
159
|
-
[8.0, 6.95],
|
|
160
|
-
[13.0, 7.58],
|
|
161
|
-
[9.0, 8.81],
|
|
162
|
-
[11.0, 8.33],
|
|
163
|
-
[14.0, 9.96],
|
|
164
|
-
[6.0, 7.24],
|
|
165
|
-
[4.0, 4.26],
|
|
166
|
-
[12.0, 10.84],
|
|
167
|
-
[7.0, 4.82],
|
|
168
|
-
[5.0, 5.68]
|
|
169
|
-
],
|
|
170
|
-
[
|
|
171
|
-
[10.0, 9.14],
|
|
172
|
-
[8.0, 8.14],
|
|
173
|
-
[13.0, 8.74],
|
|
174
|
-
[9.0, 8.77],
|
|
175
|
-
[11.0, 9.26],
|
|
176
|
-
[14.0, 8.1],
|
|
177
|
-
[6.0, 6.13],
|
|
178
|
-
[4.0, 3.1],
|
|
179
|
-
[12.0, 9.13],
|
|
180
|
-
[7.0, 7.26],
|
|
181
|
-
[5.0, 4.74]
|
|
182
|
-
],
|
|
183
|
-
[
|
|
184
|
-
[10.0, 7.46],
|
|
185
|
-
[8.0, 6.77],
|
|
186
|
-
[13.0, 12.74],
|
|
187
|
-
[9.0, 7.11],
|
|
188
|
-
[11.0, 7.81],
|
|
189
|
-
[14.0, 8.84],
|
|
190
|
-
[6.0, 6.08],
|
|
191
|
-
[4.0, 5.39],
|
|
192
|
-
[12.0, 8.15],
|
|
193
|
-
[7.0, 6.42],
|
|
194
|
-
[5.0, 5.73]
|
|
195
|
-
],
|
|
196
|
-
[
|
|
197
|
-
[8.0, 6.58],
|
|
198
|
-
[8.0, 5.76],
|
|
199
|
-
[8.0, 7.71],
|
|
200
|
-
[8.0, 8.84],
|
|
201
|
-
[8.0, 8.47],
|
|
202
|
-
[8.0, 7.04],
|
|
203
|
-
[8.0, 5.25],
|
|
204
|
-
[19.0, 12.5],
|
|
205
|
-
[8.0, 5.56],
|
|
206
|
-
[8.0, 7.91],
|
|
207
|
-
[8.0, 6.89]
|
|
208
|
-
]
|
|
209
|
-
];
|
|
210
|
-
const markLineOpt = {
|
|
211
|
-
animation: false,
|
|
212
|
-
label: {
|
|
213
|
-
formatter: 'y = 0.5 * x + 3',
|
|
214
|
-
align: 'right'
|
|
215
|
-
},
|
|
216
|
-
lineStyle: {
|
|
217
|
-
type: 'solid'
|
|
218
|
-
},
|
|
219
|
-
tooltip: {
|
|
220
|
-
formatter: 'y = 0.5 * x + 3'
|
|
221
|
-
},
|
|
222
|
-
data: [
|
|
223
|
-
[
|
|
224
|
-
{
|
|
225
|
-
coord: [0, 3],
|
|
226
|
-
symbol: 'none'
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
coord: [20, 13],
|
|
230
|
-
symbol: 'none'
|
|
231
|
-
}
|
|
232
|
-
]
|
|
233
|
-
]
|
|
234
|
-
};
|
|
235
|
-
let options = {
|
|
236
|
-
title: {
|
|
237
|
-
text: "Anscombe's quartet",
|
|
238
|
-
left: 'center',
|
|
239
|
-
top: 0
|
|
240
|
-
},
|
|
241
|
-
grid: [
|
|
242
|
-
{ left: '7%', top: '7%', width: '38%', height: '38%' },
|
|
243
|
-
{ right: '7%', top: '7%', width: '38%', height: '38%' },
|
|
244
|
-
{ left: '7%', bottom: '7%', width: '38%', height: '38%' },
|
|
245
|
-
{ right: '7%', bottom: '7%', width: '38%', height: '38%' }
|
|
246
|
-
],
|
|
247
|
-
tooltip: {
|
|
248
|
-
formatter: 'Group {a}: ({c})'
|
|
249
|
-
},
|
|
250
|
-
xAxis: [
|
|
251
|
-
{ gridIndex: 0, min: 0, max: 20 },
|
|
252
|
-
{ gridIndex: 1, min: 0, max: 20 },
|
|
253
|
-
{ gridIndex: 2, min: 0, max: 20 },
|
|
254
|
-
{ gridIndex: 3, min: 0, max: 20 }
|
|
255
|
-
],
|
|
256
|
-
yAxis: [
|
|
257
|
-
{ gridIndex: 0, min: 0, max: 15 },
|
|
258
|
-
{ gridIndex: 1, min: 0, max: 15 },
|
|
259
|
-
{ gridIndex: 2, min: 0, max: 15 },
|
|
260
|
-
{ gridIndex: 3, min: 0, max: 15 }
|
|
261
|
-
],
|
|
262
|
-
toolbox: {
|
|
263
|
-
show: true,
|
|
264
|
-
feature: {
|
|
265
|
-
saveAsImage: {
|
|
266
|
-
show: true
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
series: [
|
|
271
|
-
{
|
|
272
|
-
name: 'I',
|
|
273
|
-
type: 'scatter',
|
|
274
|
-
xAxisIndex: 0,
|
|
275
|
-
yAxisIndex: 0,
|
|
276
|
-
data: dataAll[0],
|
|
277
|
-
markLine: markLineOpt
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
name: 'II',
|
|
281
|
-
type: 'scatter',
|
|
282
|
-
xAxisIndex: 1,
|
|
283
|
-
yAxisIndex: 1,
|
|
284
|
-
data: dataAll[1],
|
|
285
|
-
markLine: markLineOpt
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
name: 'III',
|
|
289
|
-
type: 'scatter',
|
|
290
|
-
xAxisIndex: 2,
|
|
291
|
-
yAxisIndex: 2,
|
|
292
|
-
data: dataAll[2],
|
|
293
|
-
markLine: markLineOpt
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
name: 'IV',
|
|
297
|
-
type: 'scatter',
|
|
298
|
-
xAxisIndex: 3,
|
|
299
|
-
yAxisIndex: 3,
|
|
300
|
-
data: dataAll[3],
|
|
301
|
-
markLine: markLineOpt
|
|
302
|
-
}
|
|
303
|
-
]
|
|
304
|
-
};
|
|
305
|
-
</script>
|
|
306
|
-
|
|
307
|
-
<ECharts config="options"/>
|
|
308
|
-
```
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: ECharts Options
|
|
3
|
-
description: Graphene charts are based on ECharts. Pass options to ECharts directly using the echartsOptions property.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Graphene charts are based on ECharts. Pass options to ECharts directly using the echartsOptions property.
|
|
7
|
-
|
|
8
|
-
> **Warning:** `echartsOptions` allow you to customize your chart with any combination of eCharts config options. Many config combinations can result in "broken" looking charts. Proceed with caution, and test your charts, particularly at different screen widths.
|
|
9
|
-
|
|
10
|
-
ECharts settings are specified in config object. Graphene generates this config for you through the props you pass to your chart.
|
|
11
|
-
|
|
12
|
-
If you can't get your chart to look "just right" with standard chart , you can use `echartsOptions` to customize your chart by adding or overriding the eCharts config directly.
|
|
13
|
-
|
|
14
|
-
## ECharts Options Object
|
|
15
|
-
|
|
16
|
-
The options object is passed as follows. **Note the double curly braces.**
|
|
17
|
-
|
|
18
|
-
```markdown
|
|
19
|
-
<BarChart
|
|
20
|
-
data="query_name"
|
|
21
|
-
x=column_x
|
|
22
|
-
y=column_y
|
|
23
|
-
echartsOptions="{exampleOption: 'exampleValue'"}
|
|
24
|
-
/>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
See the [eCharts docs](https://echarts.apache.org/en/option.html) for a full reference of config options.
|
|
28
|
-
|
|
29
|
-
Note that LLMs such as ChatGPT and GitHub Copilot are reasonably good at generating eCharts options if you explain what you are trying to achieve.
|
|
30
|
-
|
|
31
|
-
## Series Options Object
|
|
32
|
-
|
|
33
|
-
Often if you are making custom changes to a chart, you will need to adjust options within ECharts' `series`. When you have a multi-series chart, each series shows up separately in the ECharts configuration generated by Graphene.
|
|
34
|
-
|
|
35
|
-
For example, if you have a stacked bar with 4 series, this is what the underlying config object might look like:
|
|
36
|
-
```javascript
|
|
37
|
-
series: [
|
|
38
|
-
{type: 'bar', barWidth: 5, name: 'Canada', data: [200,5525,222,444,666]},
|
|
39
|
-
{type: 'bar', barWidth: 5, name: 'US', data: [1200,1555,1222,4144,6616]},
|
|
40
|
-
{type: 'bar', barWidth: 5, name: 'UK', data: [2060,525,262,4844,4666]},
|
|
41
|
-
{type: 'bar', barWidth: 5, name: 'Australia', data: [2200,5555,2252,8444,3666]}
|
|
42
|
-
]
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
If you wanted to add a custom border to the bars with `echartsOptions`, you would need to manually repeat for each series. E.g.,
|
|
46
|
-
|
|
47
|
-
**Example:**
|
|
48
|
-
|
|
49
|
-
```html
|
|
50
|
-
<BarChart
|
|
51
|
-
data="country_sales"
|
|
52
|
-
x=date
|
|
53
|
-
y=sales
|
|
54
|
-
series=country
|
|
55
|
-
echartsOptions="{
|
|
56
|
-
series: [
|
|
57
|
-
{itemStyle: {
|
|
58
|
-
borderWidth: 1,
|
|
59
|
-
borderColor: 'red'
|
|
60
|
-
"},
|
|
61
|
-
{itemStyle: {
|
|
62
|
-
borderWidth: 1,
|
|
63
|
-
borderColor: 'red'
|
|
64
|
-
}},
|
|
65
|
-
{itemStyle: {
|
|
66
|
-
borderWidth: 1,
|
|
67
|
-
borderColor: 'red'
|
|
68
|
-
}},
|
|
69
|
-
{itemStyle: {
|
|
70
|
-
borderWidth: 1,
|
|
71
|
-
borderColor: 'red'
|
|
72
|
-
}}
|
|
73
|
-
]
|
|
74
|
-
}}
|
|
75
|
-
/>
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
With `seriesOptions`, you can specify the changes once and have them applied to all series in the chart, like so:
|
|
79
|
-
|
|
80
|
-
```country_sales
|
|
81
|
-
select 'Canada' as country, 2020 as year, 100 as sales
|
|
82
|
-
union all
|
|
83
|
-
select 'Canada' as country, 2021 as year, 150 as sales
|
|
84
|
-
union all
|
|
85
|
-
select 'Canada' as country, 2022 as year, 200 as sales
|
|
86
|
-
union all
|
|
87
|
-
select 'Canada' as country, 2023 as year, 250 as sales
|
|
88
|
-
union all
|
|
89
|
-
select 'US' as country, 2020 as year, 200 as sales
|
|
90
|
-
union all
|
|
91
|
-
select 'US' as country, 2021 as year, 350 as sales
|
|
92
|
-
union all
|
|
93
|
-
select 'US' as country, 2022 as year, 400 as sales
|
|
94
|
-
union all
|
|
95
|
-
select 'US' as country, 2023 as year, 450 as sales
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**Example:**
|
|
99
|
-
|
|
100
|
-
```svelte
|
|
101
|
-
<BarChart
|
|
102
|
-
data="country_sales"
|
|
103
|
-
x=date
|
|
104
|
-
y=sales
|
|
105
|
-
series=country
|
|
106
|
-
seriesOptions={{
|
|
107
|
-
itemStyle: {
|
|
108
|
-
borderWidth: 1,
|
|
109
|
-
borderColor: 'red'
|
|
110
|
-
}
|
|
111
|
-
}}
|
|
112
|
-
/>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Print ECharts Config
|
|
116
|
-
|
|
117
|
-
You can print the current eCharts config for a chart by adding `printEchartsConfig=true` to the chart. This will print the full config just below the chart.
|
|
118
|
-
|
|
119
|
-
This includes both any default Graphene config and any `echartsOptions` you have specified, and so can be useful for debugging.
|
|
120
|
-
|
|
121
|
-
```svelte
|
|
122
|
-
<BarChart
|
|
123
|
-
data="query_name"
|
|
124
|
-
x=column_x
|
|
125
|
-
y=column_y
|
|
126
|
-
echartsOptions="{exampleOption: 'exampleValue'"}
|
|
127
|
-
printEchartsConfig=true
|
|
128
|
-
/>
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Example Configs
|
|
132
|
-
|
|
133
|
-
### Customize the Legend Position
|
|
134
|
-
|
|
135
|
-
**Example:**
|
|
136
|
-
|
|
137
|
-
```svelte
|
|
138
|
-
echartsOptions="{
|
|
139
|
-
legend: {
|
|
140
|
-
right: 'right',
|
|
141
|
-
top: 'middle',
|
|
142
|
-
align: 'auto',
|
|
143
|
-
orient: 'vertical',
|
|
144
|
-
padding: 7,
|
|
145
|
-
borderColor: '#ccc',
|
|
146
|
-
borderWidth: 1,
|
|
147
|
-
",
|
|
148
|
-
grid: {
|
|
149
|
-
right: '120px'
|
|
150
|
-
}
|
|
151
|
-
}}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Add Data Zoom
|
|
155
|
-
|
|
156
|
-
**Example:**
|
|
157
|
-
|
|
158
|
-
```svelte
|
|
159
|
-
echartsOptions="{
|
|
160
|
-
dataZoom: [
|
|
161
|
-
{
|
|
162
|
-
start: 0,
|
|
163
|
-
end: 100,
|
|
164
|
-
",
|
|
165
|
-
],
|
|
166
|
-
grid: {
|
|
167
|
-
bottom: '50px',
|
|
168
|
-
},
|
|
169
|
-
}}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Add Series Labels Next to Chart
|
|
173
|
-
|
|
174
|
-
**Example:**
|
|
175
|
-
|
|
176
|
-
```svelte
|
|
177
|
-
echartsOptions={{
|
|
178
|
-
series: [
|
|
179
|
-
{
|
|
180
|
-
endLabel: {
|
|
181
|
-
show: true,
|
|
182
|
-
formatter: (params) => params.seriesName,
|
|
183
|
-
offset: [0, 0], // [x, y] offset from the end of the line
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
endLabel: {
|
|
188
|
-
show: true,
|
|
189
|
-
formatter: (params) => params.seriesName,
|
|
190
|
-
offset: [0, 0], // [x, y] offset from the end of the line
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
],
|
|
194
|
-
grid: {
|
|
195
|
-
right: '50px',
|
|
196
|
-
top: '10px'
|
|
197
|
-
}
|
|
198
|
-
}}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Add Axis Pointer to Tooltip
|
|
202
|
-
|
|
203
|
-
**Example:**
|
|
204
|
-
|
|
205
|
-
```svelte
|
|
206
|
-
echartsOptions={{
|
|
207
|
-
tooltip: {
|
|
208
|
-
trigger: 'axis',
|
|
209
|
-
axisPointer: {
|
|
210
|
-
type: 'cross',
|
|
211
|
-
label: {
|
|
212
|
-
backgroundColor: '#6a7985'
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
}}
|
|
217
|
-
```
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Funnel Chart
|
|
3
|
-
description: Display how a single metric changes across a series of stages. Funnel charts are widely used for visualizing conversion.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Use funnel charts to display a single metric across a series of stages. Funnel charts are widely used for visualizing conversion.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**Example:**
|
|
10
|
-
|
|
11
|
-
```markdown
|
|
12
|
-
<FunnelChart
|
|
13
|
-
data="funnel_data"
|
|
14
|
-
nameCol=stage
|
|
15
|
-
valueCol=customers
|
|
16
|
-
/>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Examples
|
|
20
|
-
|
|
21
|
-
### Ascending
|
|
22
|
-
|
|
23
|
-
**Example:**
|
|
24
|
-
|
|
25
|
-
```markdown
|
|
26
|
-
<FunnelChart
|
|
27
|
-
data="funnel_data"
|
|
28
|
-
nameCol=stage
|
|
29
|
-
valueCol=customers
|
|
30
|
-
funnelSort=ascending
|
|
31
|
-
/>
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Alignment
|
|
35
|
-
|
|
36
|
-
**Example:**
|
|
37
|
-
|
|
38
|
-
```markdown
|
|
39
|
-
<FunnelChart
|
|
40
|
-
data="funnel_data"
|
|
41
|
-
nameCol=stage
|
|
42
|
-
valueCol=customers
|
|
43
|
-
funnelAlign=left
|
|
44
|
-
/>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Show Percent Label
|
|
48
|
-
|
|
49
|
-
**Example:**
|
|
50
|
-
|
|
51
|
-
```markdown
|
|
52
|
-
<FunnelChart
|
|
53
|
-
data="funnel_data"
|
|
54
|
-
nameCol=stage
|
|
55
|
-
valueCol=customers
|
|
56
|
-
showPercent=true
|
|
57
|
-
/>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Options
|
|
61
|
-
|
|
62
|
-
### Data
|
|
63
|
-
|
|
64
|
-
| Property | Required | Type | Default | Description |
|
|
65
|
-
|----------|----------|------|---------|-------------|
|
|
66
|
-
| data | ✓ | query name | | Query name, wrapped in curly braces |
|
|
67
|
-
| nameCol | ✓ | column name | | Column to use for the name of the chart |
|
|
68
|
-
| valueCol | ✓ | column name | | Column to use for the value of the chart |
|
|
69
|
-
| 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. |
|
|
70
|
-
| 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.). |
|
|
71
|
-
|
|
72
|
-
### Formatting & Styling
|
|
73
|
-
|
|
74
|
-
| Property | Type | Default | Description |
|
|
75
|
-
|----------|------|---------|-------------|
|
|
76
|
-
| valueFmt | Excel-style format \| built-in format \| custom format | | Format to use for `valueCol` ([see available formats](/core-concepts/formatting)) |
|
|
77
|
-
| outlineColor | CSS name \| hexademical \| RGB \| HSL | transparent | Border color. Only accepts a single color. |
|
|
78
|
-
| outlineWidth | number | 1 | Border Width. It should be a natural number. |
|
|
79
|
-
| labelPosition | left/right/inside | inside | Position of funnel item's label. |
|
|
80
|
-
| showPercent | true/false | false | Show percentage in data labels |
|
|
81
|
-
| funnelSort | none/ascending/descending | none | Data sorting of the chart. |
|
|
82
|
-
| funnelAlign | left/right/center | center | Alignment of funnel. |
|
|
83
|
-
| 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']}` |
|
|
84
|
-
|
|
85
|
-
### Chart
|
|
86
|
-
|
|
87
|
-
| Property | Type | Default | Description |
|
|
88
|
-
|----------|------|---------|-------------|
|
|
89
|
-
| title | string | | Chart title. Appears at top left of chart. |
|
|
90
|
-
| subtitle | string | | Chart subtitle. Appears just under title. |
|
|
91
|
-
| legend | true/false | true | Turns legend on or off. Legend appears at top center of chart. |
|
|
92
|
-
| 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/). |
|
|
93
|
-
|
|
94
|
-
### Custom Echarts Options
|
|
95
|
-
|
|
96
|
-
| Property | Type | Default | Description |
|
|
97
|
-
|----------|------|---------|-------------|
|
|
98
|
-
| echartsOptions | `{{exampleOption:'exampleValue'}}` | | Custom Echarts options to override the default options. See [reference page](/components/charts/echarts-options) for available options. |
|
|
99
|
-
| 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. |
|
|
100
|
-
| 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 |
|
|
101
|
-
|
|
102
|
-
### Interactivity
|
|
103
|
-
|
|
104
|
-
| Property | Type | Description |
|
|
105
|
-
|----------|------|-------------|
|
|
106
|
-
| connectGroup | | Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same `connectGroup` name will become connected |
|