@graphenedata/cli 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/LICENSE.md +100 -0
  2. package/THIRD_PARTY_NOTICES.md +12 -0
  3. package/cli.ts +157 -0
  4. package/dist/cli/cli.js +43 -0
  5. package/dist/docs/data_apps/components/charts/annotations.md +673 -0
  6. package/dist/docs/data_apps/components/charts/area-chart.md +202 -0
  7. package/dist/docs/data_apps/components/charts/bar-chart.md +317 -0
  8. package/dist/docs/data_apps/components/charts/box-plot.md +190 -0
  9. package/dist/docs/data_apps/components/charts/bubble-chart.md +151 -0
  10. package/dist/docs/data_apps/components/charts/calendar-heatmap.md +112 -0
  11. package/dist/docs/data_apps/components/charts/custom-echarts.md +308 -0
  12. package/dist/docs/data_apps/components/charts/echarts-options.md +217 -0
  13. package/dist/docs/data_apps/components/charts/funnel-chart.md +106 -0
  14. package/dist/docs/data_apps/components/charts/heatmap.md +180 -0
  15. package/dist/docs/data_apps/components/charts/histogram.md +107 -0
  16. package/dist/docs/data_apps/components/charts/line-chart.md +265 -0
  17. package/dist/docs/data_apps/components/charts/mixed-type-charts.md +240 -0
  18. package/dist/docs/data_apps/components/charts/sankey-diagram.md +301 -0
  19. package/dist/docs/data_apps/components/charts/scatter-plot.md +134 -0
  20. package/dist/docs/data_apps/components/charts/sparkline.md +68 -0
  21. package/dist/docs/data_apps/components/data/big-value.md +153 -0
  22. package/dist/docs/data_apps/components/data/delta.md +89 -0
  23. package/dist/docs/data_apps/components/data/table.md +470 -0
  24. package/dist/docs/data_apps/components/data/value.md +97 -0
  25. package/dist/docs/data_apps/components/inputs/button-group.md +154 -0
  26. package/dist/docs/data_apps/components/inputs/checkbox.md +52 -0
  27. package/dist/docs/data_apps/components/inputs/date-input.md +131 -0
  28. package/dist/docs/data_apps/components/inputs/date-range.md +124 -0
  29. package/dist/docs/data_apps/components/inputs/dimension-grid.md +67 -0
  30. package/dist/docs/data_apps/components/inputs/dropdown.md +199 -0
  31. package/dist/docs/data_apps/components/inputs/index.md +3 -0
  32. package/dist/docs/data_apps/components/inputs/slider.md +126 -0
  33. package/dist/docs/data_apps/components/inputs/text-input.md +86 -0
  34. package/dist/docs/data_apps/components/maps/area-map.md +397 -0
  35. package/dist/docs/data_apps/components/maps/base-map.md +269 -0
  36. package/dist/docs/data_apps/components/maps/bubble-map.md +361 -0
  37. package/dist/docs/data_apps/components/maps/point-map.md +326 -0
  38. package/dist/docs/data_apps/components/maps/us-map.md +167 -0
  39. package/dist/docs/data_apps/components/ui/accordion.md +116 -0
  40. package/dist/docs/data_apps/components/ui/alert.md +37 -0
  41. package/dist/docs/data_apps/components/ui/big-link.md +19 -0
  42. package/dist/docs/data_apps/components/ui/details.md +58 -0
  43. package/dist/docs/data_apps/components/ui/download-data.md +41 -0
  44. package/dist/docs/data_apps/components/ui/embed.md +47 -0
  45. package/dist/docs/data_apps/components/ui/grid.md +45 -0
  46. package/dist/docs/data_apps/components/ui/image.md +61 -0
  47. package/dist/docs/data_apps/components/ui/info.md +47 -0
  48. package/dist/docs/data_apps/components/ui/last-refreshed.md +28 -0
  49. package/dist/docs/data_apps/components/ui/link-button.md +20 -0
  50. package/dist/docs/data_apps/components/ui/link.md +40 -0
  51. package/dist/docs/data_apps/components/ui/modal.md +57 -0
  52. package/dist/docs/data_apps/components/ui/note.md +32 -0
  53. package/dist/docs/data_apps/components/ui/print-format-components.md +85 -0
  54. package/dist/docs/data_apps/components/ui/tabs.md +122 -0
  55. package/dist/docs/graphene.md +129 -0
  56. package/dist/ui/app.css +332 -0
  57. package/dist/ui/assets/favicon.ico +0 -0
  58. package/dist/ui/component-utilities/autoFormatting.js +301 -0
  59. package/dist/ui/component-utilities/builtInFormats.js +482 -0
  60. package/dist/ui/component-utilities/chartContext.js +12 -0
  61. package/dist/ui/component-utilities/chartWindowDebug.js +21 -0
  62. package/dist/ui/component-utilities/checkInputs.js +95 -0
  63. package/dist/ui/component-utilities/convert.js +15 -0
  64. package/dist/ui/component-utilities/dateParsing.js +57 -0
  65. package/dist/ui/component-utilities/dropdownContext.ts +1 -0
  66. package/dist/ui/component-utilities/echarts.js +262 -0
  67. package/dist/ui/component-utilities/echartsThemes.js +453 -0
  68. package/dist/ui/component-utilities/formatTitle.js +24 -0
  69. package/dist/ui/component-utilities/formatting.js +258 -0
  70. package/dist/ui/component-utilities/getColumnExtents.js +79 -0
  71. package/dist/ui/component-utilities/getColumnSummary.js +67 -0
  72. package/dist/ui/component-utilities/getCompletedData.js +114 -0
  73. package/dist/ui/component-utilities/getDistinctCount.js +7 -0
  74. package/dist/ui/component-utilities/getDistinctValues.js +15 -0
  75. package/dist/ui/component-utilities/getSeriesConfig.js +236 -0
  76. package/dist/ui/component-utilities/getSortedData.js +7 -0
  77. package/dist/ui/component-utilities/getStackPercentages.js +43 -0
  78. package/dist/ui/component-utilities/getStackedData.js +17 -0
  79. package/dist/ui/component-utilities/getYAxisIndex.js +15 -0
  80. package/dist/ui/component-utilities/globalContexts.js +1 -0
  81. package/dist/ui/component-utilities/helpers/getCompletedData.helpers.js +119 -0
  82. package/dist/ui/component-utilities/inputUtils.ts +25 -0
  83. package/dist/ui/component-utilities/replaceNulls.js +14 -0
  84. package/dist/ui/component-utilities/tableUtils.ts +120 -0
  85. package/dist/ui/component-utilities/themeStores.ts +116 -0
  86. package/dist/ui/components/Area.svelte +174 -0
  87. package/dist/ui/components/AreaChart.svelte +150 -0
  88. package/dist/ui/components/Bar.svelte +326 -0
  89. package/dist/ui/components/BarChart.svelte +194 -0
  90. package/dist/ui/components/BigValue.svelte +69 -0
  91. package/dist/ui/components/Chart.svelte +1070 -0
  92. package/dist/ui/components/Column.svelte +172 -0
  93. package/dist/ui/components/DateRange.svelte +324 -0
  94. package/dist/ui/components/Dropdown.svelte +738 -0
  95. package/dist/ui/components/DropdownOption.svelte +21 -0
  96. package/dist/ui/components/ECharts.svelte +77 -0
  97. package/dist/ui/components/ErrorChart.svelte +54 -0
  98. package/dist/ui/components/GrapheneQuery.svelte +12 -0
  99. package/dist/ui/components/InlineDelta.svelte +150 -0
  100. package/dist/ui/components/Line.svelte +210 -0
  101. package/dist/ui/components/LineChart.svelte +178 -0
  102. package/dist/ui/components/PieChart.svelte +36 -0
  103. package/dist/ui/components/QueryLoad.svelte +82 -0
  104. package/dist/ui/components/Row.svelte +14 -0
  105. package/dist/ui/components/SortIcon.svelte +32 -0
  106. package/dist/ui/components/Table.svelte +19 -0
  107. package/dist/ui/components/TableCell.svelte +75 -0
  108. package/dist/ui/components/TableGroupRow.svelte +136 -0
  109. package/dist/ui/components/TableGroupToggle.svelte +42 -0
  110. package/dist/ui/components/TableHeader.svelte +242 -0
  111. package/dist/ui/components/TableRow.svelte +283 -0
  112. package/dist/ui/components/TableSubtotalRow.svelte +62 -0
  113. package/dist/ui/components/TableTotalRow.svelte +88 -0
  114. package/dist/ui/components/TextInput.svelte +92 -0
  115. package/dist/ui/components/_Table.svelte +516 -0
  116. package/dist/ui/internal/clientCache.ts +43 -0
  117. package/dist/ui/internal/queryEngine.ts +169 -0
  118. package/dist/ui/internal/telemetry.ts +28 -0
  119. package/dist/ui/internal/theme.ts +88 -0
  120. package/dist/ui/layout.svelte +3 -0
  121. package/dist/ui/playwright.config.ts +30 -0
  122. package/dist/ui/web.js +106 -0
  123. package/package.json +71 -0
@@ -0,0 +1,397 @@
1
+ ---
2
+ title: Area Map
3
+ description: Compare a metric across different regions on a map using a choropleth map
4
+ ---
5
+
6
+ Compare a metric across different regions on a map using a choropleth map
7
+
8
+ **Example:**
9
+
10
+ ```svelte
11
+ <AreaMap
12
+ data="la_zip_sales"
13
+ areaCol=zip_code
14
+ geoJsonUrl='path/to/your/geoJson'
15
+ geoId=ZCTA5CE10
16
+ value=sales
17
+ valueFmt=usd
18
+ height=250
19
+ />
20
+ ```
21
+
22
+
23
+ ## Examples
24
+
25
+ ### Custom Basemap
26
+ You can add a different basemap by passing in a basemap URL. You can find examples here: https://leaflet-extras.github.io/leaflet-providers/preview/
27
+
28
+ **Example:**
29
+
30
+ **Note:** you need to wrap the url in curly braces and backticks to avoid the curly braces in the URL being read as variables on your page
31
+
32
+ ```svelte
33
+ <AreaMap
34
+ data="la_zip_sales"
35
+ areaCol=zip_code
36
+ geoJsonUrl='path/to/your/geoJson'
37
+ geoId=ZCTA5CE10
38
+ value=sales
39
+ valueFmt=usd
40
+ height=250
41
+ basemap="`https://tile.openstreetmap.org/{z"/{x}/{y}.png`}
42
+ />
43
+ ```
44
+
45
+ ### Using an Online GeoJSON
46
+
47
+
48
+ **Example:**
49
+
50
+ ```svelte
51
+ <AreaMap
52
+ data="orders_by_state"
53
+ areaCol=state
54
+ geoJsonUrl=https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_admin_1_states_provinces.geojson
55
+ geoId=name
56
+ value=orders
57
+ />
58
+ ```
59
+
60
+ ### Custom Tooltip
61
+
62
+ #### `tooltipType=hover`
63
+
64
+ **Example:**
65
+
66
+ ```svelte
67
+ <AreaMap
68
+ data="la_zip_sales"
69
+ areaCol=zip_code
70
+ geoJsonUrl='path/to/your/geoJson'
71
+ geoId=ZCTA5CE10
72
+ value=sales
73
+ valueFmt=usd
74
+ height=250
75
+ tooltip="[
76
+ {id: 'zip_code', fmt: 'id', showColumnName: false, valueClass: 'text-xl font-semibold'",
77
+ {id: 'sales', fmt: 'eur', fieldClass: 'text-[grey]', valueClass: 'text-[green]'}
78
+ ]}
79
+ />
80
+ ```
81
+
82
+ #### With clickable link and `tooltipType=click`
83
+
84
+ **Example:**
85
+
86
+ ```svelte
87
+ <AreaMap
88
+ data="la_zip_sales"
89
+ areaCol=zip_code
90
+ geoJsonUrl='path/to/your/geoJson'
91
+ geoId=ZCTA5CE10
92
+ value=sales
93
+ valueFmt=usd
94
+ height=250
95
+ tooltipType=click
96
+ tooltip="[
97
+ {id: 'zip_code', fmt: 'id', showColumnName: false, valueClass: 'text-xl font-semibold'",
98
+ {id: 'sales', fmt: 'eur', fieldClass: 'text-[grey]', valueClass: 'text-[green]'},
99
+ {id: 'link_col', showColumnName: false, contentType: 'link', linkLabel: 'Click here', valueClass: 'font-bold mt-1'}
100
+ ]}
101
+ />
102
+ ```
103
+
104
+ ### Custom Styling
105
+
106
+ **Example:**
107
+
108
+ ```svelte
109
+ <AreaMap
110
+ data="la_zip_sales"
111
+ areaCol=zip_code
112
+ geoJsonUrl='path/to/your/geoJson'
113
+ geoId=ZCTA5CE10
114
+ value=sales
115
+ valueFmt=usd
116
+ height=250
117
+ color=#fff5d9
118
+ borderColor=#737373
119
+ borderWidth=0.5
120
+ />
121
+ ```
122
+
123
+ ### Custom Color Palette
124
+
125
+ **Example:**
126
+
127
+ ```svelte
128
+ <AreaMap
129
+ data="la_zip_sales"
130
+ areaCol=zip_code
131
+ geoJsonUrl='path/to/your/geoJson'
132
+ geoId=ZCTA5CE10
133
+ value=sales
134
+ valueFmt=usd
135
+ height=250
136
+ colorPalette="[
137
+ ['yellow', 'yellow'],
138
+ ['orange', 'orange'],
139
+ ['red', 'red'],
140
+ ['darkred', 'darkred'],
141
+ ]"
142
+ />
143
+ ```
144
+
145
+ ### Link Drilldown
146
+ Pass in a `link` column to enable navigation on click of the point. These can be absolute or relative URLs
147
+
148
+ **Example:**
149
+
150
+ ```svelte
151
+ <AreaMap
152
+ data="la_zip_sales"
153
+ areaCol=zip_code
154
+ geoJsonUrl='path/to/your/geoJson'
155
+ geoId=ZCTA5CE10
156
+ value=sales
157
+ valueFmt=usd
158
+ height=250
159
+ link=link_col
160
+ />
161
+ ```
162
+
163
+ ### Use Map as Input
164
+ Use the `name` prop to set an input name for the map - when a point is clicked, it will set the input value to that row of data
165
+
166
+ **Example:**
167
+
168
+ ```svelte
169
+ <AreaMap
170
+ data="la_zip_sales"
171
+ areaCol=zip_code
172
+ geoJsonUrl='path/to/your/geoJson'
173
+ geoId=ZCTA5CE10
174
+ value=sales
175
+ valueFmt=usd
176
+ height=250
177
+ name=my_area_map
178
+ />
179
+ ```
180
+
181
+ *Click an area on the map to see the input value get updated:*
182
+
183
+ #### Selected value for `{inputs.my_area_map}`:
184
+
185
+ <pre class="text-sm">{JSON.stringify(inputs.my_area_map, null, 2)}</pre>
186
+
187
+ #### Selected value for `{inputs.my_area_map.zip_code}`:
188
+
189
+ {inputs.my_area_map.zip_code}
190
+
191
+
192
+ #### Filtered Data
193
+ <DataTable data="filtered_areas">
194
+ <Column id=id/>
195
+ <Column id=zip_code fmt=id/>
196
+ <Column id=sales fmt=usd/>
197
+ </DataTable>
198
+
199
+ ### Legends
200
+
201
+
202
+ #### Categorical Legend
203
+
204
+ **Example:**
205
+
206
+ ```svelte
207
+ <AreaMap
208
+ data="grouped_locations"
209
+ lat=lat
210
+ long=long
211
+ value=Category
212
+ geoId=ZCTA5CE10
213
+ areaCol=zip_code
214
+ />
215
+ ```
216
+
217
+ #### Custom Colors
218
+ Set custom legend colors using the `colorPalette` prop to match the number of categories; excess categorical options will default to standard colors.
219
+
220
+ **Example:**
221
+
222
+ ```svelte
223
+ <AreaMap
224
+ data="grouped_locations"
225
+ lat=lat
226
+ long=long
227
+ value=Category
228
+ geoId=ZCTA5CE10
229
+ areaCol=zip_code
230
+ colorPalette={['#C65D47', '#5BAF7A', '#4A8EBA', '#D35B85', '#E1C16D', '#6F5B9A', '#4E8D8D']}
231
+ />
232
+ ```
233
+
234
+ #### Scalar Legend
235
+
236
+ **Example:**
237
+
238
+ ```svelte
239
+ <AreaMap
240
+ data="grouped_locations"
241
+ lat=lat
242
+ long=long
243
+ value=sales
244
+ geoId=ZCTA5CE10
245
+ areaCol=zip_code
246
+ valueFmt=usd
247
+ />
248
+ ```
249
+
250
+ #### Custom Colors
251
+ Define scalar legend colors using the `colorPalette` prop, allowing specified colors to create a gradient based on the range of values.
252
+
253
+ **Example:**
254
+
255
+ ```svelte
256
+ <AreaMap
257
+ data="grouped_locations"
258
+ lat=lat
259
+ long=long
260
+ value=sales
261
+ geoId=ZCTA5CE10
262
+ areaCol=zip_code
263
+ colorPalette={['#C65D47', '#4A8EBA']}
264
+ valueFmt=usd
265
+ />
266
+ ```
267
+
268
+ ## Required GeoJSON Data Structure
269
+ The GeoJSON data you pass to the map must be a feature collection. [See here for an example](https://gist.github.com/sgillies/1233327#file-geojson-spec-1-0-L50)
270
+
271
+ ## Map Resources
272
+
273
+
274
+ Below are a selection of publically available GeoJSON files that may be useful for mapping. These are from the [Natural Earth Data](https://www.naturalearthdata.com) project, and hosted by [GeoJSON.xyz](https://geojson.xyz).
275
+
276
+ ### Country, State, and City Locations
277
+
278
+ <DataTable data="useful_geojson_urls" rows=100>
279
+ <Column id=file/>
280
+ <Column id=category/>
281
+ <Column id=scale/>
282
+ <Column id=summary/>
283
+ <Column id=size fmt='0.0,," MB"'/>
284
+ <Column id=url contentType=link title=URL/>
285
+ </DataTable>
286
+
287
+ <Details title="All GeoJSON Files">
288
+
289
+ <DataTable data="all_geojson_urls" rows=all compact>
290
+ <Column id=file/>
291
+ <Column id=category/>
292
+ <Column id=scale/>
293
+ <Column id=summary/>
294
+ <Column id=size fmt='0.0,," MB"'/>
295
+ <Column id=url contentType=link title=URL/>
296
+ </DataTable>
297
+
298
+ </Details>
299
+
300
+ ## Options
301
+
302
+ ### Areas
303
+
304
+ | Property | Description | Required | Options |
305
+ |----------|-------------|----------|---------|
306
+ | data | Query result, referenced using curly braces | true | query name |
307
+ | geoJsonUrl | Path to source geoJSON data from - can be a URL (see Map Resources) or a file in your project. If the file is in your `static` directory in the root of your project, reference it as `geoJsonUrl="/your_file.geojson"` | true | URL |
308
+ | areaCol | Column in the data that specifies the area each row belongs to. | true | column name |
309
+ | geoId | Property in the GeoJSON that uniquely identifies each feature. | true | geoJSON property name |
310
+ | value | Column that determines the value displayed for each area (used for color scale) | false | column name |
311
+ | valueFmt | Format string for displaying the value. | false | format string |
312
+ | title | Title for the map | false | string |
313
+ | subtitle | Subtitle - appears under the title | false | string |
314
+ | ignoreZoom | Stops map from zooming out to show all data for this layer | false | true, false | false |
315
+
316
+ ### Color Scale
317
+
318
+ | Property | Description | Options | Default |
319
+ |----------|-------------|---------|---------|
320
+ | colorPalette | Array of colors used for theming the areas based on data | array of colors | - |
321
+ | min | Minimum value to use for the color scale. | number | min of value column |
322
+ | max | Maximum value to use for the color scale. | number | max of value column |
323
+
324
+ ### Legend
325
+
326
+ | Property | Description | Required | Options | Default |
327
+ |----------|-------------|----------|---------|---------|
328
+ | legend | Turns legend on or off | false | true, false | true |
329
+ | legendType | Appends a categorical or scalar legend to the map | false | categorical, scalar | - |
330
+ | legendPosition | Determines the legend's position on the map, with options provided | false | bottomLeft, topLeft, bottomRight, topRight | bottomLeft |
331
+
332
+ ### Interactivity
333
+
334
+ | Property | Description | Options |
335
+ |----------|-------------|---------|
336
+ | link | URL to navigate to when a area is clicked. | URL |
337
+ | name | Input name. Can be referenced on your page with `{inputs.my_input_name}` | string |
338
+
339
+ ### Styling
340
+
341
+ | Property | Description | Options | Default |
342
+ |----------|-------------|---------|---------|
343
+ | color | Color for the areas. Use when you want all areas to be the same color. | CSS color value | - |
344
+ | borderWidth | Width of the border around each area. | pixel value | 0.75 |
345
+ | borderColor | Color of the border around each area. | CSS color value | white |
346
+ | opacity | Opacity of the areas. | number between 0 and 1 | 0.8 |
347
+
348
+ ### Selected State
349
+
350
+ | Property | Description | Options | Default |
351
+ |----------|-------------|---------|---------|
352
+ | selectedColor | When area is selected: Color for the areas. Use when you want all areas to be the same color. | CSS color value | - |
353
+ | selectedBorderWidth | When area is selected: Width of the border around each area. | pixel value | 0.75 |
354
+ | selectedBorderColor | When area is selected: Color of the border around each area. | CSS color value | white |
355
+ | selectedOpacity | When area is selected: Opacity of the areas. | number between 0 and 1 | 0.8 |
356
+
357
+ ### Tooltips
358
+
359
+ | Property | Description | Options | Default |
360
+ |----------|-------------|---------|---------|
361
+ | showTooltip | Whether to show tooltips | true, false | true |
362
+ | tooltipType | Determines whether tooltips are activated by hover or click. | hover, click | hover |
363
+ | tooltipClass | CSS class applied to the tooltip content. You can pass Tailwind classes into this prop to custom-style the tooltip | CSS class | - |
364
+ | tooltip | Configuration for tooltips associated with each area. See below example for format | array of objects | - |
365
+
366
+ #### `tooltip` example:
367
+
368
+ ```javascript
369
+ tooltip="[
370
+ {id: 'zip_code', fmt: 'id', showColumnName: false, valueClass: 'text-xl font-semibold'",
371
+ {id: 'sales', fmt: 'eur', fieldClass: 'text-[grey]', valueClass: 'text-[green]'},
372
+ {id: 'zip_code', showColumnName: false, contentType: 'link', linkLabel: 'Click here', valueClass: 'font-bold mt-1'}
373
+ ]}
374
+ ```
375
+
376
+ #### All options available in `tooltip`:
377
+ - `id`: column ID
378
+ - `title`: custom string to use as title of field
379
+ - `fmt`: format to use for value
380
+ - `showColumnName`: whether to show the column name. If `false`, only the value will be shown
381
+ - `contentType`: currently can only be "link"
382
+ - `linkLabel`: text to show for a link when contentType="link"
383
+ - `formatColumnTitle`: whether to automatically uppercase the first letter of the title. Only applies when `title` not passed explicitly
384
+ - `valueClass`: custom Tailwind classes to style the values
385
+ - `fieldClass`: custom Tailwind classes to style the column names
386
+
387
+ ### Base Map
388
+
389
+ | Property | Description | Options |
390
+ |----------|-------------|---------|
391
+ | basemap | URL template for the basemap tiles. | URL |
392
+ | attribution | Attribution text to display on the map (e.g., "© OpenStreetMap contributors"). | text |
393
+ | title | Optional title displayed above the map. | text |
394
+ | startingLat | Starting latitude for the map center. | latitude coordinate |
395
+ | startingLong | Starting longitude for the map center. | longitude coordinate |
396
+ | startingZoom | Initial zoom level of the map. | number (1 to 18) |
397
+ | height | Height of the map in pixels. | pixel value | 300 |
@@ -0,0 +1,269 @@
1
+ ---
2
+ title: Base Map
3
+ description: Combine multiple map layers including areas, points, and bubbles.
4
+ ---
5
+
6
+ Combine multiple map layers including areas, points, and bubbles.
7
+
8
+ **Example:**
9
+
10
+ ```html
11
+ <BaseMap>
12
+ <Areas data="la_zip_sales" geoId=ZCTA5CE10 areaCol=zip_code value=sales valueFmt=usd/>
13
+ <Points data="la_locations" lat=lat long=long color=#179917/>
14
+ </BaseMap>
15
+ ```
16
+
17
+
18
+ ## Overview
19
+ The BaseMap component provides a flexible and extensible way to create maps with multiple layers. This component serves as the foundation for AreaMap, PointMap, and BubbleMap.
20
+
21
+ Within BaseMap, you can add layers using the following components:
22
+ - `<Areas/>`
23
+ - `<Points/>`
24
+ - `<Bubbles/>`
25
+
26
+ ## Examples
27
+
28
+ See the pages for [Area Map](/components/maps/area-map), [Point Map](/components/maps/point-map), and [Bubble Map](/components/maps/bubble-map) for examples specific to those layers. The same options can be applied to the layer components within BaseMap.
29
+
30
+ ### Adding Multiple Layers
31
+
32
+ **Example:**
33
+
34
+ ```svelte
35
+ <BaseMap>
36
+ <Areas
37
+ data="la_zip_sales"
38
+ areaCol=zip_code
39
+ geoJsonUrl="path/to/your/geoJSON"
40
+ geoId=ZCTA5CE10
41
+ value=sales
42
+ valueFmt=usd
43
+ />
44
+ <Bubbles
45
+ data="la_locations"
46
+ lat=lat
47
+ long=long
48
+ size=sales
49
+ sizeFmt=usd
50
+ value=sales
51
+ valueFmt=usd
52
+ pointName=point_name
53
+ colorPalette={['yellow','orange','red','darkred']}
54
+ opacity=0.5
55
+ />
56
+ </BaseMap>
57
+ ```
58
+
59
+ ### Custom Basemap
60
+ You can add a different basemap by passing in a basemap URL. You can find examples here: https://leaflet-extras.github.io/leaflet-providers/preview/
61
+
62
+ **Example:**
63
+
64
+ ```svelte
65
+ <BaseMap basemap="`https://tile.openstreetmap.org/{z"/{x}/{y}.png`} attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'>
66
+ <Points
67
+ data="la_locations"
68
+ lat=lat
69
+ long=long
70
+ value=sales
71
+ valueFmt=usd
72
+ pointName=point_name
73
+ color=violet
74
+ borderColor=black
75
+ borderWidth=2
76
+ />
77
+ </BaseMap>
78
+ ```
79
+
80
+ ### Custom Tooltip
81
+
82
+ #### `tooltipType=hover`
83
+
84
+ **Example:**
85
+
86
+ ```svelte
87
+ <BaseMap>
88
+ <Areas
89
+ data="la_zip_sales"
90
+ areaCol=zip_code
91
+ geoJsonUrl='/geo-json/ca_california_zip_codes_geo_1.min.json'
92
+ geoId=ZCTA5CE10
93
+ value=sales
94
+ valueFmt=usd
95
+ height=250
96
+ tooltip="[
97
+ {id: 'zip_code', fmt: 'id', showColumnName: false, valueClass: 'text-xl font-semibold'",
98
+ {id: 'sales', fmt: 'eur', fieldClass: 'text-[grey]', valueClass: 'text-[green]'},
99
+ {id: 'zip_code', showColumnName: false, contentType: 'link', linkLabel: 'Click here', valueClass: 'font-bold mt-1'}
100
+ ]}
101
+ />
102
+ </BaseMap>
103
+ ```
104
+
105
+ #### With clickable link and `tooltipType=click`
106
+
107
+ **Example:**
108
+
109
+ ```svelte
110
+ <BaseMap>
111
+ <Areas
112
+ data="la_zip_sales"
113
+ areaCol=zip_code
114
+ geoJsonUrl='/geo-json/ca_california_zip_codes_geo_1.min.json'
115
+ geoId=ZCTA5CE10
116
+ value=sales
117
+ valueFmt=usd
118
+ height=250
119
+ tooltipType=click
120
+ tooltip="[
121
+ {id: 'zip_code', fmt: 'id', showColumnName: false, valueClass: 'text-xl font-semibold'",
122
+ {id: 'sales', fmt: 'eur', fieldClass: 'text-[grey]', valueClass: 'text-[green]'},
123
+ {id: 'link_col', showColumnName: false, contentType: 'link', linkLabel: 'Click here', valueClass: 'font-bold mt-1'}
124
+ ]}
125
+ />
126
+ </BaseMap>
127
+ ```
128
+
129
+ ## Map Resources
130
+
131
+
132
+ Below are a selection of publically available GeoJSON files that may be useful for mapping. These are from the [Natural Earth Data](https://www.naturalearthdata.com) project, and hosted by [GeoJSON.xyz](https://geojson.xyz).
133
+
134
+ ### Country, State, and City Locations
135
+
136
+ | file | category | scale | summary | size | url |
137
+ |------|----------|-------|---------|------|-----|
138
+ | {useful_geojson_urls.file} | {useful_geojson_urls.category} | {useful_geojson_urls.scale} | {useful_geojson_urls.summary} | {useful_geojson_urls.size} | {useful_geojson_urls.url} |
139
+
140
+ <details>
141
+ <summary>All GeoJSON Files</summary>
142
+
143
+ | file | category | scale | summary | size | url |
144
+ |------|----------|-------|---------|------|-----|
145
+ | {all_geojson_urls.file} | {all_geojson_urls.category} | {all_geojson_urls.scale} | {all_geojson_urls.summary} | {all_geojson_urls.size} | {all_geojson_urls.url} |
146
+
147
+ </details>
148
+
149
+ ## Base Map Options
150
+
151
+ | Property | Type | Description |
152
+ |----------|------|-------------|
153
+ | basemap | URL | URL template for the basemap tiles. |
154
+ | attribution | text | Attribution text to display on the map (e.g., "© OpenStreetMap contributors"). |
155
+ | title | text | Optional title displayed above the map. |
156
+ | startingLat | latitude coordinate | Starting latitude for the map center. |
157
+ | startingLong | longitude coordinate | Starting longitude for the map center. |
158
+ | startingZoom | number (1 to 18) | Initial zoom level of the map. |
159
+ | height | pixel value (default: 300) | Height of the map in pixels. |
160
+ | title | string | Title for the map |
161
+ | subtitle | string | Subtitle - appears under the title |
162
+
163
+ ## Layer Options
164
+
165
+ ### Areas
166
+ Use the `<Areas/>` component to add an area layer
167
+
168
+ | Property | Required | Type | Description |
169
+ |----------|----------|------|-------------|
170
+ | data | ✓ | query name | Query result, referenced using curly braces. |
171
+ | geoJsonUrl | ✓ | URL | Path to source geoJSON data from - can be a URL (see [Map Resources](#map-resources)) or a file in your project. If the file is in your `static` directory in the root of your project, reference it as `geoJsonUrl="/your_file.geojson"` |
172
+ | areaCol | ✓ | column name | Column in the data that specifies the area each row belongs to. |
173
+ | geoId | ✓ | geoJSON property name | Property in the GeoJSON that uniquely identifies each feature. |
174
+ | value | | column name | Column that determines the value displayed for each area (used for color scale). |
175
+ | valueFmt | | format string | Format string for displaying the value. |
176
+ | ignoreZoom | | true/false (default: false) | Stops map from zooming out to show all data for this layer |
177
+
178
+ ### Points
179
+ Use the `<Points/>` component to add an area layer
180
+
181
+ | Property | Required | Type | Description |
182
+ |----------|----------|------|-------------|
183
+ | data | ✓ | query name | Query result, referenced using curly braces. |
184
+ | lat | ✓ | column name | Column containing latitude values. |
185
+ | long | ✓ | column name | Column containing longitude values. |
186
+ | value | | column name | Column that determines the value displayed at each point. |
187
+ | valueFmt | | format string | Format string for displaying the value. |
188
+ | pointName | | column name | Column containing the names/labels of the points - by default, this is shown as the title of the tooltip. |
189
+ | ignoreZoom | | true/false (default: false) | Stops map from zooming out to show all data for this layer |
190
+
191
+ ### Bubbles
192
+ Use the `<Bubbles/>` component to add an area layer
193
+
194
+ | Property | Required | Type | Description |
195
+ |----------|----------|------|-------------|
196
+ | data | ✓ | query name | Query result, referenced using curly braces. |
197
+ | lat | ✓ | column name | Column containing latitude values. |
198
+ | long | ✓ | column name | Column containing longitude values. |
199
+ | size | ✓ | column name | Column that determines the size displayed for each point. |
200
+ | sizeFmt | | format string | Format string for displaying the size value in tooltips. |
201
+ | maxSize | | number (default: 20) | Maximum size of the bubbles. |
202
+ | value | | column name | Column that determines the value displayed at each point (used for color scale). |
203
+ | valueFmt | | format string | Format string for displaying the value. |
204
+ | pointName | | column name | Column containing the names/labels of the points - by default, this is shown as the title of the tooltip. |
205
+ | paneType | | text | Specifies the type of pane where the bubbles will be rendered. |
206
+ | z | | number | Represents the z-index value for the pane, controlling its stacking order relative to other panes (higher values are on top, e.g., z=2 is above z=1). |
207
+ | ignoreZoom | | true/false (default: false) | Stops map from zooming out to show all data for this layer |
208
+
209
+ ### Common Layer Options
210
+
211
+ #### Color Scale
212
+
213
+ | Property | Type | Description |
214
+ |----------|------|-------------|
215
+ | colorPalette | array of colors | Array of colors used for theming the points or areas based on data. |
216
+ | min | number (default: min of value column) | Minimum value to use for the color scale. |
217
+ | max | number (default: max of value column) | Maximum value to use for the color scale. |
218
+
219
+ #### Interactivity
220
+
221
+ | Property | Type | Description |
222
+ |----------|------|-------------|
223
+ | link | URL | URL to navigate to when a point or area is clicked. |
224
+ | name | string | Input name. Can be referenced on your page with {inputs.my_input_name}. |
225
+
226
+ #### Styling
227
+ | Property | Type | Description |
228
+ |----------|------|-------------|
229
+ | color | CSS color value | Color for the points or areas. Use when you want all points or areas to be the same color. |
230
+ | borderWidth | pixel value | Width of the border around each point or area. |
231
+ | borderColor | CSS color value | Color of the border around each point or area. |
232
+ | opacity | number between 0 and 1 | Opacity of the points or areas. |
233
+
234
+ #### Selected State
235
+ | Property | Type | Description |
236
+ |----------|------|-------------|
237
+ | selectedColor | CSS color value | When point or area is selected: Color for the points or areas. |
238
+ | selectedBorderWidth | pixel value | When point or area is selected: Width of the border around each point or area. |
239
+ | selectedBorderColor | CSS color value | When point or area is selected: Color of the border around each point or area. |
240
+ | selectedOpacity | number between 0 and 1 | When point or area is selected: Opacity of the points or areas. |
241
+
242
+ #### Tooltips
243
+ | Property | Type | Default | Description |
244
+ |----------|------|---------|-------------|
245
+ | showTooltip | true/false | true | Whether to show tooltips. |
246
+ | tooltipType | hover/click | hover | Determines whether tooltips are activated by hover or click. |
247
+ | tooltipClass | CSS class | | CSS class applied to the tooltip content. You can pass Tailwind classes into this prop to custom-style the tooltip. |
248
+ | tooltip | array of objects | | Configuration for tooltips associated with each area. See below example for format |
249
+
250
+ #### `tooltip` example:
251
+
252
+ ```javascript
253
+ tooltip="[
254
+ {id: 'zip_code', fmt: 'id', showColumnName: false, valueClass: 'text-xl font-semibold'",
255
+ {id: 'sales', fmt: 'eur', fieldClass: 'text-[grey]', valueClass: 'text-[green]'},
256
+ {id: 'zip_code', showColumnName: false, contentType: 'link', linkLabel: 'Click here', valueClass: 'font-bold mt-1'}
257
+ ]}
258
+ ```
259
+
260
+ #### All options available in `tooltip`:
261
+ - `id`: column ID
262
+ - `title`: custom string to use as title of field
263
+ - `fmt`: format to use for value
264
+ - `showColumnName`: whether to show the column name. If `false`, only the value will be shown
265
+ - `contentType`: currently can only be "link"
266
+ - `linkLabel`: text to show for a link when contentType="link"
267
+ - `formatColumnTitle`: whether to automatically uppercase the first letter of the title. Only applies when `title` not passed explicitly
268
+ - `valueClass`: custom Tailwind classes to style the values
269
+ - `fieldClass`: custom Tailwind classes to style the column names