@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.
Files changed (69) hide show
  1. package/cli.ts +7 -43
  2. package/dist/cli/cli.js +529 -293
  3. package/dist/docs/graphene.md +924 -63
  4. package/dist/ui/component-utilities/echarts.js +3 -1
  5. package/dist/ui/component-utilities/themeStores.ts +35 -7
  6. package/dist/ui/components/AreaChart.svelte +2 -1
  7. package/dist/ui/components/BarChart.svelte +2 -1
  8. package/dist/ui/components/BigValue.svelte +1 -1
  9. package/dist/ui/components/Chart.svelte +10 -1
  10. package/dist/ui/components/ECharts.svelte +2 -0
  11. package/dist/ui/components/LineChart.svelte +2 -1
  12. package/dist/ui/components/PieChart.svelte +1 -1
  13. package/dist/ui/components/QueryLoad.svelte +5 -6
  14. package/dist/ui/components/TableRow.svelte +1 -1
  15. package/dist/ui/components/_Table.svelte +2 -0
  16. package/dist/ui/internal/queryEngine.ts +16 -13
  17. package/dist/ui/internal/telemetry.ts +5 -3
  18. package/dist/ui/web.js +26 -11
  19. package/package.json +2 -1
  20. package/dist/docs/data_apps/components/charts/annotations.md +0 -673
  21. package/dist/docs/data_apps/components/charts/area-chart.md +0 -202
  22. package/dist/docs/data_apps/components/charts/bar-chart.md +0 -317
  23. package/dist/docs/data_apps/components/charts/box-plot.md +0 -190
  24. package/dist/docs/data_apps/components/charts/bubble-chart.md +0 -151
  25. package/dist/docs/data_apps/components/charts/calendar-heatmap.md +0 -112
  26. package/dist/docs/data_apps/components/charts/custom-echarts.md +0 -308
  27. package/dist/docs/data_apps/components/charts/echarts-options.md +0 -217
  28. package/dist/docs/data_apps/components/charts/funnel-chart.md +0 -106
  29. package/dist/docs/data_apps/components/charts/heatmap.md +0 -180
  30. package/dist/docs/data_apps/components/charts/histogram.md +0 -107
  31. package/dist/docs/data_apps/components/charts/line-chart.md +0 -265
  32. package/dist/docs/data_apps/components/charts/mixed-type-charts.md +0 -240
  33. package/dist/docs/data_apps/components/charts/sankey-diagram.md +0 -301
  34. package/dist/docs/data_apps/components/charts/scatter-plot.md +0 -134
  35. package/dist/docs/data_apps/components/charts/sparkline.md +0 -68
  36. package/dist/docs/data_apps/components/data/big-value.md +0 -153
  37. package/dist/docs/data_apps/components/data/delta.md +0 -89
  38. package/dist/docs/data_apps/components/data/table.md +0 -470
  39. package/dist/docs/data_apps/components/data/value.md +0 -97
  40. package/dist/docs/data_apps/components/inputs/button-group.md +0 -154
  41. package/dist/docs/data_apps/components/inputs/checkbox.md +0 -52
  42. package/dist/docs/data_apps/components/inputs/date-input.md +0 -131
  43. package/dist/docs/data_apps/components/inputs/date-range.md +0 -124
  44. package/dist/docs/data_apps/components/inputs/dimension-grid.md +0 -67
  45. package/dist/docs/data_apps/components/inputs/dropdown.md +0 -199
  46. package/dist/docs/data_apps/components/inputs/index.md +0 -3
  47. package/dist/docs/data_apps/components/inputs/slider.md +0 -126
  48. package/dist/docs/data_apps/components/inputs/text-input.md +0 -86
  49. package/dist/docs/data_apps/components/maps/area-map.md +0 -397
  50. package/dist/docs/data_apps/components/maps/base-map.md +0 -269
  51. package/dist/docs/data_apps/components/maps/bubble-map.md +0 -361
  52. package/dist/docs/data_apps/components/maps/point-map.md +0 -326
  53. package/dist/docs/data_apps/components/maps/us-map.md +0 -167
  54. package/dist/docs/data_apps/components/ui/accordion.md +0 -116
  55. package/dist/docs/data_apps/components/ui/alert.md +0 -37
  56. package/dist/docs/data_apps/components/ui/big-link.md +0 -19
  57. package/dist/docs/data_apps/components/ui/details.md +0 -58
  58. package/dist/docs/data_apps/components/ui/download-data.md +0 -41
  59. package/dist/docs/data_apps/components/ui/embed.md +0 -47
  60. package/dist/docs/data_apps/components/ui/grid.md +0 -45
  61. package/dist/docs/data_apps/components/ui/image.md +0 -61
  62. package/dist/docs/data_apps/components/ui/info.md +0 -47
  63. package/dist/docs/data_apps/components/ui/last-refreshed.md +0 -28
  64. package/dist/docs/data_apps/components/ui/link-button.md +0 -20
  65. package/dist/docs/data_apps/components/ui/link.md +0 -40
  66. package/dist/docs/data_apps/components/ui/modal.md +0 -57
  67. package/dist/docs/data_apps/components/ui/note.md +0 -32
  68. package/dist/docs/data_apps/components/ui/print-format-components.md +0 -85
  69. package/dist/docs/data_apps/components/ui/tabs.md +0 -122
@@ -1,673 +0,0 @@
1
- ---
2
- title: Annotations
3
- description: Add important context directly to a chart - highlight areas, or specific points to make it easier for your reader to draw insights.
4
- ---
5
-
6
- Use annotations to add important context directly to a chart - highlight areas, or specific points to make it easier for your reader to draw insights.
7
-
8
- ## At a glance
9
-
10
- Graphene currently offers 4 types of annotations, which can be defined inline or with a dataset:
11
- - [`ReferenceLine`](#reference-line): draw a line on a chart (e.g. sales target, launch dates, linear regression)
12
- - [`ReferenceArea`](#reference-area): highlight an area on a chart (e.g. holiday shopping periods, metric control ranges)
13
- - [`ReferencePoint`](#reference-point): highlight specific points on a chart (e.g. anomalies, points of interest)
14
- - [`Callout`](#callout): draw attention to data (e.g. data trend explanation)
15
-
16
- **Example:**
17
-
18
- ```html
19
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
20
- <ReferenceLine y=7500 label="Reference Line" hideValue labelPosition="aboveStart" color=positive/>
21
- <ReferenceArea xMin='2020-03-14' xMax='2020-08-15' label="Reference Area" color=warning/>
22
- <ReferencePoint x="2019-07-01" y=6590 label="Reference Point" labelPosition=bottom color=negative/>
23
- <Callout x="2021-05-01" y=11012 labelPosition=bottom labelWidth=fit>
24
- Callout
25
- Data trending up here
26
- </Callout>
27
- </LineChart>
28
- ```
29
-
30
- # Reference Line
31
-
32
- Reference lines allow you to add lines to a chart to provide additional context within the visualization. These lines can be produced by providing a specific value (`y=50` or `x='2020-03-14'`) or by providing a dataset (e.g., `date`, `event_name`).
33
-
34
- If you provide coordinates for `[x, y]` and `[x2, y2]`, you can create sloped lines between points.
35
-
36
- When a dataset is provided, `ReferenceLine` can generate multiple lines - one for each row in the dataset. This can be helpful for plotting things like important milestones, launch dates, or experiment start dates.
37
-
38
- ## Examples
39
-
40
- ### Y-axis Defined Inline
41
-
42
- **Example:**
43
-
44
- ```html
45
- <LineChart data="orders_by_month" x=month y=sales yAxisTitle="Sales per Month" yFmt=usd0>
46
- <ReferenceLine y=9000 label="Target"/>
47
- </LineChart>
48
- ```
49
-
50
- ### X-axis Defined Inline
51
-
52
- **Example:**
53
-
54
- ```html
55
- <LineChart data="orders_by_month" x=month y=sales yAxisTitle="Sales per Month" yFmt=usd0>
56
- <ReferenceLine x='2019-09-18' label="Launch" hideValue=true/>
57
- </LineChart>
58
- ```
59
-
60
- ### Y-axis Multiple Lines
61
-
62
- **Example:**
63
-
64
- ```html
65
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0 yAxisTitle="Sales per Month">
66
- <ReferenceLine y=9000 label="Target" labelPosition=belowEnd/>
67
- <ReferenceLine y=10500 label="Forecast"/>
68
- </LineChart>
69
- ```
70
-
71
- ### X-axis from Data
72
-
73
-
74
- **Example:**
75
-
76
- ```html
77
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0 yAxisTitle="Sales per Month">
78
- <ReferenceLine data="multiple_dates" x=start_date label=campaign_name hideValue/>
79
- </LineChart>
80
- ```
81
-
82
- ### Sloped Line Inline
83
-
84
- **Example:**
85
-
86
- ```html
87
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0 yAxisTitle="Sales per Month">
88
- <ReferenceLine x='2019-01-01' y=6500 x2='2021-12-01' y2=12000 label="Growth Trend" labelPosition=belowEnd/>
89
- </LineChart>
90
- ```
91
-
92
- ### Linear Regression from Data
93
-
94
-
95
- **Example:**
96
-
97
- ```html
98
- <ScatterPlot data="orders_by_state" x=sales y=num_orders xMin=0 yMin=0>
99
- <ReferenceLine data="regression" x=x y=y x2=x2 y2=y2 label=label color=base-content-muted lineType=solid/>
100
- </ScatterPlot>
101
- ```
102
-
103
- ### Custom Styling
104
-
105
- **Example:**
106
-
107
- ```html
108
- <LineChart data="orders_by_month" x=month y=sales_usd0k yAxisTitle="Sales per Month">
109
- <ReferenceLine y=110000 color=negative hideValue=true lineWidth=3 lineType=solid/>
110
- </LineChart>
111
- ```
112
-
113
- ### Label Positions
114
-
115
- **Example:**
116
-
117
- ```html
118
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0k yAxisTitle="Sales per Month">
119
- <ReferenceLine y=4000 label=aboveStart labelPosition=aboveStart hideValue/>
120
- <ReferenceLine y=4000 label=aboveCenter labelPosition=aboveCenter hideValue/>
121
- <ReferenceLine y=4000 label=aboveEnd labelPosition=aboveEnd hideValue/>
122
- <ReferenceLine y=4000 label=belowStart labelPosition=belowStart hideValue/>
123
- <ReferenceLine y=4000 label=belowCenter labelPosition=belowCenter hideValue/>
124
- <ReferenceLine y=4000 label=belowEnd labelPosition=belowEnd hideValue/>
125
- </LineChart>
126
- ```
127
-
128
- ### Colours
129
-
130
- **Example:**
131
-
132
- ```html
133
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0k yAxisTitle="Sales per Month">
134
- <ReferenceLine y=1500 color=negative label=negative/>
135
- <ReferenceLine y=3500 color=warning label=warning/>
136
- <ReferenceLine y=5500 color=positive label=positive/>
137
- <ReferenceLine y=7500 color=info label=info/>
138
- <ReferenceLine y=9500 color=base-content-muted label=base-content-muted/>
139
- <ReferenceLine y=11500 color=#63178f label=custom/>
140
- </LineChart>
141
- ```
142
-
143
- ## Options
144
- A reference line can be produced by defining values inline or by supplying a dataset, and the required props are different for each of those cases.
145
-
146
- ### Defining Values Inline
147
-
148
- | Property | Description | Required | Options |
149
- |----------|-------------|----------|---------|
150
- | x | x-axis value where line will be plotted, or coordinate where line will start if x2 is provided | false | number \| string \| date |
151
- | y | y-axis value where line will be plotted, or coordinate where line will start if y2 is provided | false | number |
152
- | x2 | x-axis value for line endpoint | false | number \| string \| date |
153
- | y2 | y-axis value for line endpoint | false | number |
154
- | label | Text to show as label for the line. If no label is provided, the value will be used. | false | string |
155
-
156
- This table shows how you combine `x`, `y`, `x2`, and `y2` to create different types of lines:
157
-
158
- | x | y | x2 | y2 | Result |
159
- |---|----|----|----|---------|
160
- | 5 | null | null | null | Vertical line at x=5 |
161
- | null | 100 | null | null | Horizontal line at y=100 |
162
- | 5 | 100 | null | null | Vertical line at x=5 (ignores y) |
163
- | 5 | 100 | 10 | 200 | Sloped line from [5, 100] to [10, 200] |
164
- | 5 | 100 | null | 200 | Vertical line from [5, 100] to [5, 200] |
165
- | 5 | 100 | 10 | null | Horizontal line from [5, 100] to [10, 100] |
166
-
167
- > **Warning:** If you provide `[x, y]` and `[x2, y2]`, coordinates must fall within the chart's boundaries in order for the line to be drawn.
168
-
169
- ### Supplying a Dataset
170
-
171
- | Property | Description | Required | Options |
172
- |----------|-------------|----------|---------|
173
- | data | Query name, wrapped in curly braces | true | query name |
174
- | x | Column containing x-axis values for lines (or starting points if x2 is provided) | false | column name |
175
- | y | Column containing y-axis values for lines (or starting points if y2 is provided) | false | column name |
176
- | x2 | Column containing x-axis values for line endpoints. | false | column name |
177
- | y2 | Column containing y-axis values for line endpoints. | false | column name |
178
- | label | Column containing a label to use for each line | false | column name |
179
- | hideValue | Option to remove the value from the label | false | true/false (default: false) |
180
-
181
- | x | y | x2 | y2 | Result |
182
- |---|----|----|----|---------|
183
- | x_col | null | null | null | Vertical lines at values in x_col |
184
- | null | y_col | null | null | Horizontal lines at values in y_col |
185
- | x_col | y_col | null | null | Vertical lines at x_col (ignores y_col) |
186
- | x_col | y_col | x2_col | y2_col | Sloped Lines from [x_col, y_col] to [x2_col, y2_col] |
187
-
188
- > **Warning:** If you provide `[x, y]` and `[x2, y2]`, coordinates must fall within the chart's boundaries in order for lines to be drawn.
189
-
190
- ### Styling
191
-
192
- | Property | Description | Options | Default |
193
- |----------|-------------|---------|---------|
194
- | color | Color to override default line and label colors | CSS name \| hexademical \| RGB \| HSL | - |
195
- | lineColor | Color to override default line color. If used, takes precedence over `color` | CSS name \| hexademical \| RGB \| HSL | - |
196
- | lineType | Options to show breaks in a line (dashed or dotted) | solid, dashed, dotted | dashed |
197
- | lineWidth | Thickness of line (in pixels) | number | 1.3 |
198
- | symbolStart | The type of symbol used to mark the start of the line | circle, rect, roundRect, triangle, diamond, pin, arrow, none | circle |
199
- | symbolStartSize | The size of the symbol at the start of the line | number | 8 |
200
- | symbolEnd | The type of symbol used to mark the end of the line | circle, rect, roundRect, triangle, diamond, pin, arrow, none | circle |
201
- | symbolEndSize | The size of the symbol at the end of the line | number | 8 |
202
- | labelPosition | Where label will appear on the line | aboveStart, aboveCenter, aboveEnd, belowStart, belowCenter, belowEnd | aboveEnd |
203
- | labelColor | Color to override default label color. If used, takes precedence over `color` | CSS name \| hexademical \| RGB \| HSL | - |
204
- | labelBackground | Option to show a white semi-transparent background behind the label. Helps when label is shown in front of darker colours. | true, false | true |
205
- | labelPadding | Padding between the text and the border of the label background | number | - |
206
- | labelBorderWidth | The thickness of the border around the label (in pixels) | number | - |
207
- | labelBorderRadius | The radius of rounded corners on the label background (in pixels) | number | - |
208
- | labelBorderColor | The color of the border around the label background | CSS name \| hexademical \| RGB \| HSL | - |
209
- | labelBorderType | The type of border around the label background (dashed or dotted) | solid, dotted, dashed | - |
210
- | fontSize | The size of the font in the label | number | - |
211
- | align | How to align the label to the symbol, and the text within the label | left, center, right | - |
212
- | bold | Make the label text bold | true, false | false |
213
- | italic | Make the label text italic | true, false | false |
214
-
215
- # Reference Area
216
-
217
- Reference areas allow you to add highlighted ranges to a chart. These ranges can be:
218
- - Along the x-axis (e.g., recession date ranges)
219
- - Along the y-axis (e.g., control threshold for a metric)
220
- - Both (e.g, highlighting a specific series of points in the middle of the chart)
221
-
222
- Reference areas can be produced by defining the x and y-axis values inline (e.g., `xMin='2020-03-14' xMax='2020-06-30'`) or by supplying a dataset (e.g., `start_date`, `end_date`, `name`).
223
-
224
- When a dataset is provided, `ReferenceArea` can generate multiple areas - one for each row in the dataset.
225
-
226
- ## Examples
227
-
228
- ### X-axis Defined Inline
229
-
230
- **Example:**
231
-
232
- ```html
233
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0 yAxisTitle="Sales per Month">
234
- <ReferenceArea xMin='2020-03-14' xMax='2020-08-15' label=First color=warning/>
235
- <ReferenceArea xMin='2021-03-14' xMax='2021-08-15' label=Second/>
236
- </LineChart>
237
- ```
238
-
239
- ### Y-axis Defined Inline
240
-
241
- **Example:**
242
-
243
- ```html
244
- <LineChart data="orders_by_month" x=month y=num_orders yAxisTitle="Orders per Month">
245
- <ReferenceArea yMin=250 color=positive label="Good"/>
246
- <ReferenceArea yMin=100 yMax=250 color=warning label="Okay"/>
247
- <ReferenceArea yMin=0 yMax=100 color=negative label="Bad"/>
248
- </LineChart>
249
- ```
250
-
251
- ### X-axis from Data
252
-
253
- **Example:**
254
-
255
- ```html
256
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0 yAxisTitle="Sales per Month">
257
- <ReferenceArea data="multiple_dates" xMin=start_date xMax=end_date label=campaign_name/>
258
- </LineChart>
259
- ```
260
-
261
- ### Bar Chart
262
-
263
- **Example:**
264
-
265
- ```html
266
- <BarChart data="orders_by_category_2021" x=month y=sales yFmt=usd0 series=category>
267
- <ReferenceArea xMin='2021-01-01' xMax='2021-04-01'/>
268
- </BarChart>
269
- ```
270
-
271
- #### Continuous Axis Bar Charts
272
- On a continous x-axis (dates or numbers), the reference area will start and stop at the exact point on the x-axis. This means it will appear in the middle of whichever bar is at that point. If you would prefer to see the area cover the full bar, there are 2 ways to achieve this:
273
- 1. Add a buffer on either side of the range you want to highlight (e.g., instead of ending the area at `2020-07-01`, end it at `2020-07-15`)
274
- 2. Change your x-axis to categorical data (using `xType=category`). If using a date axis, you may also want to retain the axis label formatting for dates - to achieve this, you can use the `xFmt` prop (e.g., `xFmt=mmm`)
275
-
276
- ### Reference Area Box
277
-
278
- **Example:**
279
-
280
- ```html
281
- <ScatterPlot data="countries" x=gdp_usd y=gdp_growth_pct1 tooltipTitle=country series=continent>
282
- <ReferenceArea xMin=16000 xMax=24000 yMin=-0.03 yMax=0.055 label="Large and stagnant" color=base-content-muted border=true/>
283
- </ScatterPlot>
284
- ```
285
-
286
- ### Labels
287
-
288
- **Example:**
289
-
290
- ```html
291
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
292
- <ReferenceArea xMin='2019-07-01' xMax='2021-07-31' label=topLeft labelPosition=topLeft areaColor="hsla(206.25, 80%, 80%, 0.01)"/>
293
- <ReferenceArea xMin='2019-07-01' xMax='2021-07-31' label=top labelPosition=top areaColor="hsla(206.25, 80%, 80%, 0.01)"/>
294
- <ReferenceArea xMin='2019-07-01' xMax='2021-07-31' label=topRight labelPosition=topRight areaColor="hsla(206.25, 80%, 80%, 0.01)"/>
295
- <ReferenceArea xMin='2019-07-01' xMax='2021-07-31' label=left labelPosition=left areaColor="hsla(206.25, 80%, 80%, 0.01)"/>
296
- <ReferenceArea xMin='2019-07-01' xMax='2021-07-31' label=center labelPosition=center areaColor="hsla(206.25, 80%, 80%, 0.01)"/>
297
- <ReferenceArea xMin='2019-07-01' xMax='2021-07-31' label=right labelPosition=right areaColor="hsla(206.25, 80%, 80%, 0.01)"/>
298
- <ReferenceArea xMin='2019-07-01' xMax='2021-07-31' label=bottomLeft labelPosition=bottomLeft areaColor="hsla(206.25, 80%, 80%, 0.01)"/>
299
- <ReferenceArea xMin='2019-07-01' xMax='2021-07-31' label=bottom labelPosition=bottom areaColor="hsla(206.25, 80%, 80%, 0.01)"/>
300
- <ReferenceArea xMin='2019-07-01' xMax='2021-07-31' label=bottomRight labelPosition=bottomRight areaColor="hsla(206.25, 80%, 80%, 0.01)"/>
301
- </LineChart>
302
- ```
303
-
304
- #### Label Overlaps
305
- Reference areas appear behind chart gridlines, including reference area labels. If you are seeing an overlap between the gridlines and the reference area label, you can avoi this by turning gridlines off (`yGridlines=false`).
306
-
307
- ### Colours
308
-
309
- **Example:**
310
-
311
- ```html
312
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0 >
313
- <ReferenceArea xMax='2019-04-01' label=info color=info/>
314
- <ReferenceArea xMin='2019-04-01' xMax='2019-11-01' label=negative color=negative/>
315
- <ReferenceArea xMin='2019-11-01' xMax='2020-07-01' label=warning color=warning/>
316
- <ReferenceArea xMin='2020-07-01' xMax='2021-02-01' label=positive color=positive/>
317
- <ReferenceArea xMin='2021-02-01' xMax='2021-09-01' label=base-content-muted color=base-content-muted/>
318
- <ReferenceArea xMin='2021-09-01' label=custom color=#f2dbff labelColor=#4d1070/>
319
- </LineChart>
320
- ```
321
-
322
- ## Options
323
- A reference area can be produced by defining values inline or by supplying a dataset, and the required props are different for each of those cases.
324
-
325
- ### Defining Values Inline
326
-
327
- | Property | Description | Required | Options |
328
- |----------|-------------|----------|---------|
329
- | xMin | x-axis value where area should start. If left out, range will extend to the start of the x-axis. | false | number \| string \| date |
330
- | xMax | x-axis value where area should end. If left out, range will extend to the end of the x-axis. | false | number \| string \| date |
331
- | yMin | y-axis value where area should start. If left out, range will extend to the start of the y-axis. | false | number |
332
- | yMax | y-axis value where area should end. If left out, range will extend to the end of the y-axis. | false | number |
333
- | label | Text to show as label for the area | false | string |
334
-
335
- - At least 1 of `xMin`, `xMax`, `yMin`, or `yMax` is required to plot an area.
336
-
337
- ### Supplying a Dataset
338
-
339
- | Property | Description | Required | Options |
340
- |----------|-------------|----------|---------|
341
- | data | Query name, wrapped in curly braces | true | query name |
342
- | xMin | Column containing x-axis values for area start. If left out, range will extend to the start of the x-axis. | false | column name |
343
- | xMax | Column containing x-axis values for area end. If left out, range will extend to the end of the x-axis. | false | column name |
344
- | yMin | Column containing y-axis values for area start. If left out, range will extend to the start of the y-axis. | false | column name |
345
- | yMax | Column containing y-axis values for area end. If left out, range will extend to the end of the y-axis. | false | column name |
346
- | label | Column containing a label to use for each area | false | column name |
347
-
348
- - At least 1 of `xMin`, `xMax`, `yMin`, or `yMax` is required to plot an area.
349
-
350
- ### Styling
351
-
352
- | Property | Description | Options | Default |
353
- |----------|-------------|---------|---------|
354
- | color | Color to override default area and label colors | CSS name \| hexademical \| RGB \| HSL | - |
355
- | areaColor | Color to override default area color. If used, takes precedence over `color` | CSS name \| hexademical \| RGB \| HSL | - |
356
- | opacity | Opacity of the highlighted area | number | - |
357
- | border | Renders a border around the highlighted area | true, false | false |
358
- | borderColor | Color to override default border color | CSS name \| hexademical \| RGB \| HSL | - |
359
- | borderType | Options to show breaks in a line (dashed or dotted) | solid, dashed, dotted | dashed |
360
- | borderWidth | Thickness of border (in pixels) | number | - |
361
- | labelPosition | Where label will appear within the area | topLeft, top, topRight, left, center, right, bottomLeft, bottom, bottomRight | topLeft |
362
- | labelColor | Color to override default label color. If used, takes precedence over `color` | CSS name \| hexademical \| RGB \| HSL | - |
363
- | labelBackgroundColor | The color of the background behind the label | CSS name \| hexademical \| RGB \| HSL | - |
364
- | labelPadding | Padding between the text and the border of the label background | number | - |
365
- | labelBorderWidth | The thickness of the border around the label (in pixels) | number | - |
366
- | labelBorderRadius | The radius of rounded corners on the label background (in pixels) | number | - |
367
- | labelBorderColor | The color of the border around the label background | CSS name \| hexademical \| RGB \| HSL | - |
368
- | labelBorderType | The type of border around the label background (dashed or dotted) | solid, dotted, dashed | - |
369
- | fontSize | The size of the font in the label | number | - |
370
- | align | How to align the label to the symbol, and the text within the label | left, center, right | - |
371
- | bold | Make the label text bold | true, false | false |
372
- | italic | Make the label text italic | true, false | false |
373
-
374
- # Reference Point
375
-
376
- Reference points allow you to add labels on certain points to emphasize them in the chart. They can be produced by providing a specific x/y coordinate (e.g. `x="2021-05-01"` `y=11012`) or by providing a dataset (e.g. `anomalies`, `points`).
377
-
378
- When a dataset is provided, `ReferencePoint` will generate multiple points - one for each row in the dataset. This can be helpful for plotting a large number of points with a succinct syntax.
379
-
380
- ## Examples
381
-
382
- ### Defined Point
383
-
384
- **Example:**
385
-
386
- ```html
387
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
388
- <ReferencePoint x="2019-07-01" y=6590 label="2019-07-01 : Big drop" labelPosition=bottom/>
389
- </LineChart>
390
- ```
391
-
392
- ### Points from Data
393
-
394
- ```sales_drops
395
- select
396
- month,
397
- sales,
398
- concat('Sales dropped $', round(abs(sales_diff))::int::text) as label
399
- from (
400
- select
401
- month,
402
- sales,
403
- sales - lag(sales) over (order by month) as sales_diff
404
- from ${orders_by_month}
405
- )
406
- where sales_diff < -2000
407
- ```
408
-
409
- **Example:**
410
-
411
- ```html
412
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
413
- <ReferencePoint data="sales_drops" x=month y=sales label=label labelPosition=bottom align=right />
414
- </LineChart>
415
- ```
416
-
417
- ### Custom Styling
418
-
419
- **Example:**
420
-
421
- ```html
422
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
423
- <ReferencePoint
424
- x="2019-07-01"
425
- y=6590
426
- label="2019-07-01 : Big drop"
427
- labelPosition=right
428
- color=negative
429
- symbolSize=16
430
- symbolBorderWidth=1
431
- symbolBorderColor=negative
432
- symbolOpacity=0.25
433
- />
434
- </LineChart>
435
- ```
436
-
437
- ### Label Positions
438
-
439
- **Example:**
440
-
441
- ```html
442
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
443
- <ReferencePoint x="2019-07-01" y=6590 label=top labelPosition=top/>
444
- <ReferencePoint x="2019-07-01" y=6590 label=right labelPosition=right/>
445
- <ReferencePoint x="2019-07-01" y=6590 label=bottom labelPosition=bottom/>
446
- <ReferencePoint x="2019-07-01" y=6590 label=left labelPosition=left/>
447
- </LineChart>
448
- ```
449
-
450
- #### Multiline label
451
-
452
- **Example:**
453
-
454
- ```html
455
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
456
- <ReferencePoint x="2019-07-01" y=6590 labelPosition=bottom align=left>
457
- A label with
458
- line breaks in it
459
- to allow longer text
460
- </ReferencePoint>
461
- </LineChart>
462
- ```
463
-
464
- ### Colours
465
-
466
- **Example:**
467
-
468
- ```html
469
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
470
- <ReferencePoint x="2019-03-01" y=3000 color=info label=info />
471
- <ReferencePoint x="2019-09-01" y=3000 color=negative label=negative />
472
- <ReferencePoint x="2020-03-01" y=3000 color=warning label=warning />
473
- <ReferencePoint x="2020-09-01" y=3000 color=positive label=positive />
474
- <ReferencePoint x="2021-03-01" y=3000 color=base-content-muted label=base-content-muted />
475
- <ReferencePoint x="2021-09-01" y=3000 color=#63178f label=custom />
476
- </LineChart>
477
- ```
478
-
479
- ## Options
480
-
481
- ### Defining Values Inline
482
-
483
- | Property | Description | Required | Options |
484
- |----------|-------------|----------|---------|
485
- | x | x coordinate value where the point will be plotted | false | number \| string \| date |
486
- | y | y coordinate value where the point will be plotted | false | number \| string \| date |
487
- | label | Text to show as label for the point | true | string |
488
-
489
- ### Supplying a Dataset
490
-
491
- | Property | Description | Required | Options |
492
- |----------|-------------|----------|---------|
493
- | data | Query name, wrapped in curly braces | true | query name |
494
- | x | Column containing x-axis values for points | false | column name |
495
- | y | Column containing y-axis values for points | false | column name |
496
- | label | Column containing a label to use for each line | true | column name |
497
-
498
- ### Styling
499
-
500
- | Property | Description | Options | Default |
501
- |----------|-------------|---------|---------|
502
- | color | Color to override default line and label colors | CSS name \| hexademical \| RGB \| HSL | base-content-muted |
503
- | labelColor | Color to override default label color. If used, takes precedence over `color` | CSS name \| hexademical \| RGB \| HSL | - |
504
- | labelWidth | The width available for the label. If text is longer than this width, it will wrap to new lines. | fit \| string \| number | fit |
505
- | labelPadding | Padding between the text and the border of the label background | number | - |
506
- | labelPosition | Where the label will appear relative to the point | top, right, bottom, left | top |
507
- | labelBackgroundColor | The color of the background behind the label | CSS name \| hexademical \| RGB \| HSL | hsla(360, 100%, 100%, 0.7) |
508
- | labelBorderWidth | The thickness of the border around the label (in pixels) | number | - |
509
- | labelBorderRadius | The radius of rounded corners on the label background (in pixels) | number | - |
510
- | labelBorderColor | The color of the border around the label background | CSS name \| hexademical \| RGB \| HSL | - |
511
- | labelBorderType | The type of border around the label background (dashed or dotted) | solid, dotted, dashed | - |
512
- | fontSize | The size of the font in the label | number | - |
513
- | align | How to align the label to the symbol, and the text within the label | left, center, right | - |
514
- | bold | Make the label text bold | true, false | false |
515
- | italic | Make the label text italic | true, false | false |
516
- | symbol | The type of symbol used to mark the x/y coordinate(s) | circle, rect, roundRect, triangle, diamond, pin, arrow, none | circle |
517
- | symbolColor | Color to override default symbol color. If used, takes precedence over `color` | CSS name \| hexademical \| RGB \| HSL | - |
518
- | symbolSize | The size of the symbol | number | 8 |
519
- | symbolOpacity | The opacity of the symbol | number | - |
520
- | symbolBorderWidth | The width of the border around the symbol | number | - |
521
- | symbolBorderColor | The color of the border around the symbol | CSS name \| hexademical \| RGB \| HSL | - |
522
- | preserveWhitespace | When true, stops multiline labels from having whitespace at the start/end of lines trimmed | true, false | false |
523
-
524
- # Callout
525
-
526
- Callouts are very similar to reference points, just with different default styling to optimize them for slightly different use cases. Callouts allow you to add a long label somewhere on a chart to describe a trend or provide insight on the data. They can be produced by providing a specific x/y coordinate (e.g. `x="2021-05-01"` `y=11012`) or by providing a dataset (e.g. `anomalies`, `points`).
527
-
528
- When a dataset is provided, `Callout` will generate multiple points - one for each row in the dataset. This can be helpful for plotting a large number of points with a succinct syntax.
529
-
530
- ## Examples
531
-
532
- ### Defined Point
533
-
534
- **Example:**
535
-
536
- ```html
537
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
538
- <Callout x="2019-07-01" y=6590 label="Sales really dropped here" labelPosition=bottom/>
539
- </LineChart>
540
- ```
541
-
542
- ### Points from Data
543
-
544
- ```sales_drops
545
- select
546
- month,
547
- sales,
548
- concat('Sales dropped $', round(abs(sales_diff))::int::text) as label
549
- from (
550
- select
551
- month,
552
- sales,
553
- sales - lag(sales) over (order by month) as sales_diff
554
- from ${orders_by_month}
555
- )
556
- where sales_diff < -2000
557
- ```
558
-
559
- **Example:**
560
-
561
- ```html
562
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
563
- <Callout data="sales_drops" x=month y=sales label=label labelPosition=bottom align=right />
564
- </LineChart>
565
- ```
566
-
567
- ### Custom Styling
568
-
569
- **Example:**
570
-
571
- ```html
572
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
573
- <Callout
574
- x="2019-07-01"
575
- y=6590
576
- label="Sales really dropped here"
577
- labelPosition=right
578
- color=negative
579
- symbolSize=16
580
- symbolBorderWidth=1
581
- symbolBorderColor=negative
582
- symbolOpacity=0.25
583
- />
584
- </LineChart>
585
- ```
586
-
587
- ### Label Positions
588
-
589
- **Example:**
590
-
591
- ```html
592
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
593
- <Callout x="2019-07-01" y=6590 label=top labelPosition=top/>
594
- <Callout x="2019-07-01" y=6590 label=right labelPosition=right/>
595
- <Callout x="2019-07-01" y=6590 label=bottom labelPosition=bottom/>
596
- <Callout x="2019-07-01" y=6590 label=left labelPosition=left/>
597
- </LineChart>
598
- ```
599
-
600
- #### Multiline label
601
-
602
- **Example:**
603
-
604
- ```html
605
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
606
- <Callout x="2019-07-01" y=6590 labelPosition=bottom align=left>
607
- Callout
608
- with
609
- line
610
- breaks
611
- </Callout>
612
- </LineChart>
613
- ```
614
-
615
- ### Colours
616
-
617
- **Example:**
618
-
619
- ```html
620
- <LineChart data="orders_by_month" x=month y=sales yFmt=usd0>
621
- <Callout x="2019-03-01" y=3000 color=info label=info />
622
- <Callout x="2019-09-01" y=3000 color=negative label=negative />
623
- <Callout x="2020-03-01" y=3000 color=warning label=warning />
624
- <Callout x="2020-09-01" y=3000 color=positive label=positive />
625
- <Callout x="2021-03-01" y=3000 color=base-content-muted label=base-content-muted />
626
- <Callout x="2021-09-01" y=3000 color=#63178f label=custom />
627
- </LineChart>
628
- ```
629
-
630
- ## Options
631
-
632
- ### Defining Values Inline
633
-
634
- | Property | Description | Required | Options |
635
- |----------|-------------|----------|---------|
636
- | x | x coordinate value where the point will be plotted | false | number \| string \| date |
637
- | y | y coordinate value where the point will be plotted | false | number \| string \| date |
638
- | label | Text to show as label for the point | true | string |
639
-
640
- ### Supplying a Dataset
641
-
642
- | Property | Description | Required | Options |
643
- |----------|-------------|----------|---------|
644
- | data | Query name, wrapped in curly braces | true | query name |
645
- | x | Column containing x-axis values for points | false | column name |
646
- | y | Column containing y-axis values for points | false | column name |
647
- | label | Column containing a label to use for each line | true | column name |
648
-
649
- ### Styling
650
-
651
- | Property | Description | Options | Default |
652
- |----------|-------------|---------|---------|
653
- | color | Color to override default line and label colors | CSS name \| hexademical \| RGB \| HSL | base-content-muted |
654
- | labelColor | Color to override default label color. If used, takes precedence over `color` | CSS name \| hexademical \| RGB \| HSL | - |
655
- | labelWidth | The width available for the label. If text is longer than this width, it will wrap to new lines. | fit \| string \| number | fit |
656
- | labelPadding | Padding between the text and the border of the label background | number | - |
657
- | labelPosition | Where the label will appear relative to the point | top, right, bottom, left | top |
658
- | labelBackgroundColor | The color of the background behind the label | CSS name \| hexademical \| RGB \| HSL | hsla(360, 100%, 100%, 0.7) |
659
- | labelBorderWidth | The thickness of the border around the label (in pixels) | number | - |
660
- | labelBorderRadius | The radius of rounded corners on the label background (in pixels) | number | - |
661
- | labelBorderColor | The color of the border around the label background | CSS name \| hexademical \| RGB \| HSL | - |
662
- | labelBorderType | The type of border around the label background (dashed or dotted) | solid, dotted, dashed | - |
663
- | fontSize | The size of the font in the label | number | - |
664
- | align | How to align the label to the symbol, and the text within the label | left, center, right | - |
665
- | bold | Make the label text bold | true, false | false |
666
- | italic | Make the label text italic | true, false | false |
667
- | symbol | The type of symbol used to mark the x/y coordinate(s) | circle, rect, roundRect, triangle, diamond, pin, arrow, none | circle |
668
- | symbolColor | Color to override default symbol color. If used, takes precedence over `color` | CSS name \| hexademical \| RGB \| HSL | - |
669
- | symbolSize | The size of the symbol | number | 8 |
670
- | symbolOpacity | The opacity of the symbol | number | - |
671
- | symbolBorderWidth | The width of the border around the symbol | number | - |
672
- | symbolBorderColor | The color of the border around the symbol | CSS name \| hexademical \| RGB \| HSL | - |
673
- | preserveWhitespace | When true, stops multiline labels from having whitespace at the start/end of lines trimmed | true, false | false |