@uwdata/vgplot 0.4.0 → 0.6.0

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 (65) hide show
  1. package/README.md +4 -2
  2. package/dist/vgplot.js +6677 -6503
  3. package/dist/vgplot.min.js +12 -33
  4. package/package.json +8 -10
  5. package/src/api.js +347 -0
  6. package/src/connect.js +14 -0
  7. package/src/context.js +20 -0
  8. package/src/index.js +14 -303
  9. package/src/inputs.js +24 -0
  10. package/src/{directives → plot}/attributes.js +32 -5
  11. package/src/{directives → plot}/interactors.js +8 -6
  12. package/src/{directives → plot}/legends.js +14 -6
  13. package/src/{directives → plot}/marks.js +18 -13
  14. package/src/plot/named-plots.js +49 -0
  15. package/src/plot/plot.js +9 -0
  16. package/src/directives/plot.js +0 -39
  17. package/src/interactors/Highlight.js +0 -101
  18. package/src/interactors/Interval1D.js +0 -90
  19. package/src/interactors/Interval2D.js +0 -102
  20. package/src/interactors/Nearest.js +0 -66
  21. package/src/interactors/PanZoom.js +0 -121
  22. package/src/interactors/Toggle.js +0 -111
  23. package/src/interactors/util/brush.js +0 -45
  24. package/src/interactors/util/close-to.js +0 -9
  25. package/src/interactors/util/get-field.js +0 -4
  26. package/src/interactors/util/invert.js +0 -3
  27. package/src/interactors/util/patchScreenCTM.js +0 -13
  28. package/src/interactors/util/sanitize-styles.js +0 -9
  29. package/src/interactors/util/to-kebab-case.js +0 -9
  30. package/src/layout/index.js +0 -2
  31. package/src/legend.js +0 -64
  32. package/src/marks/ConnectedMark.js +0 -63
  33. package/src/marks/ContourMark.js +0 -89
  34. package/src/marks/DenseLineMark.js +0 -146
  35. package/src/marks/Density1DMark.js +0 -104
  36. package/src/marks/Density2DMark.js +0 -69
  37. package/src/marks/Grid2DMark.js +0 -191
  38. package/src/marks/HexbinMark.js +0 -88
  39. package/src/marks/Mark.js +0 -195
  40. package/src/marks/RasterMark.js +0 -122
  41. package/src/marks/RasterTileMark.js +0 -332
  42. package/src/marks/RegressionMark.js +0 -117
  43. package/src/marks/util/bin-field.js +0 -17
  44. package/src/marks/util/density.js +0 -226
  45. package/src/marks/util/extent.js +0 -56
  46. package/src/marks/util/grid.js +0 -57
  47. package/src/marks/util/handle-param.js +0 -14
  48. package/src/marks/util/is-arrow-table.js +0 -3
  49. package/src/marks/util/is-color.js +0 -18
  50. package/src/marks/util/is-constant-option.js +0 -40
  51. package/src/marks/util/is-symbol.js +0 -20
  52. package/src/marks/util/raster.js +0 -44
  53. package/src/marks/util/stats.js +0 -133
  54. package/src/marks/util/to-data-array.js +0 -58
  55. package/src/plot-attributes.js +0 -211
  56. package/src/plot-renderer.js +0 -161
  57. package/src/plot.js +0 -136
  58. package/src/spec/parse-data.js +0 -69
  59. package/src/spec/parse-spec.js +0 -422
  60. package/src/spec/to-module.js +0 -465
  61. package/src/spec/util.js +0 -43
  62. package/src/symbols.js +0 -3
  63. package/src/transforms/bin.js +0 -81
  64. package/src/transforms/index.js +0 -3
  65. /package/src/{directives → plot}/data.js +0 -0
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@uwdata/vgplot",
3
- "version": "0.4.0",
4
- "description": "A Mosaic-based interactive grammar of graphics.",
3
+ "version": "0.6.0",
4
+ "description": "An API for interactive Mosaic-powered visualizations and dashboards.",
5
5
  "keywords": [
6
6
  "data",
7
7
  "visualization",
8
+ "interaction",
8
9
  "query",
9
10
  "database",
10
11
  "duckdb",
@@ -29,13 +30,10 @@
29
30
  "prepublishOnly": "npm run test && npm run lint && npm run build"
30
31
  },
31
32
  "dependencies": {
32
- "@observablehq/plot": "^0.6.13",
33
- "@uwdata/mosaic-core": "^0.4.0",
34
- "@uwdata/mosaic-inputs": "^0.4.0",
35
- "@uwdata/mosaic-sql": "^0.4.0",
36
- "d3": "^7.8.5",
37
- "isoformat": "^0.2.1",
38
- "topojson-client": "^3.1.0"
33
+ "@uwdata/mosaic-core": "^0.6.0",
34
+ "@uwdata/mosaic-inputs": "^0.6.0",
35
+ "@uwdata/mosaic-plot": "^0.6.0",
36
+ "@uwdata/mosaic-sql": "^0.6.0"
39
37
  },
40
- "gitHead": "4114465543a21b25d6d14647db7d95af875d2519"
38
+ "gitHead": "51517b28e916e355f4ce0dc6e98aef3a1db3f7b2"
41
39
  }
package/src/api.js ADDED
@@ -0,0 +1,347 @@
1
+ export {
2
+ Param,
3
+ Selection,
4
+ coordinator
5
+ } from '@uwdata/mosaic-core';
6
+
7
+ export {
8
+ Fixed,
9
+ bin
10
+ } from '@uwdata/mosaic-plot';
11
+
12
+ export {
13
+ Query,
14
+ agg,
15
+ sql,
16
+ column,
17
+ literal,
18
+ cast,
19
+ castDouble,
20
+ castInteger,
21
+ argmax,
22
+ argmin,
23
+ arrayAgg,
24
+ avg,
25
+ count,
26
+ corr,
27
+ covarPop,
28
+ entropy,
29
+ first,
30
+ kurtosis,
31
+ mad,
32
+ max,
33
+ median,
34
+ min,
35
+ mode,
36
+ last,
37
+ product,
38
+ quantile,
39
+ skewness,
40
+ stddev,
41
+ stddevPop,
42
+ stringAgg,
43
+ sum,
44
+ variance,
45
+ varPop,
46
+ row_number,
47
+ rank,
48
+ dense_rank,
49
+ percent_rank,
50
+ cume_dist,
51
+ ntile,
52
+ lag,
53
+ lead,
54
+ first_value,
55
+ last_value,
56
+ nth_value,
57
+ dateDay, dateMonth, dateMonthDay,
58
+ and, or, not, eq, neq, gt, gte, lt, lte,
59
+ isBetween, isNotBetween,
60
+ isDistinct, isNotDistinct,
61
+ isNull, isNotNull,
62
+ centroid, centroidX, centroidY, geojson,
63
+ create, loadExtension,
64
+ loadCSV, loadJSON, loadObjects, loadParquet, loadSpatial
65
+ } from '@uwdata/mosaic-sql';
66
+
67
+ export {
68
+ menu,
69
+ search,
70
+ slider,
71
+ table
72
+ } from './inputs.js';
73
+
74
+ export {
75
+ hconcat,
76
+ vconcat
77
+ } from './layout/concat.js';
78
+
79
+ export {
80
+ hspace,
81
+ vspace
82
+ } from './layout/space.js';
83
+
84
+ export {
85
+ name,
86
+ margins,
87
+ xyDomain,
88
+ style,
89
+ width,
90
+ height,
91
+ margin,
92
+ marginLeft,
93
+ marginRight,
94
+ marginTop,
95
+ marginBottom,
96
+ align,
97
+ aspectRatio,
98
+ axis,
99
+ inset,
100
+ grid,
101
+ label,
102
+ padding,
103
+ round,
104
+ xScale,
105
+ xDomain,
106
+ xRange,
107
+ xNice,
108
+ xInset,
109
+ xInsetLeft,
110
+ xInsetRight,
111
+ xClamp,
112
+ xRound,
113
+ xAlign,
114
+ xPadding,
115
+ xPaddingInner,
116
+ xPaddingOuter,
117
+ xAxis,
118
+ xTicks,
119
+ xTickSize,
120
+ xTickSpacing,
121
+ xTickPadding,
122
+ xTickFormat,
123
+ xTickRotate,
124
+ xGrid,
125
+ xLine,
126
+ xLabel,
127
+ xLabelAnchor,
128
+ xLabelOffset,
129
+ xFontVariant,
130
+ xAriaLabel,
131
+ xAriaDescription,
132
+ xReverse,
133
+ xZero,
134
+ xBase,
135
+ xExponent,
136
+ xConstant,
137
+ yScale,
138
+ yDomain,
139
+ yRange,
140
+ yNice,
141
+ yInset,
142
+ yInsetTop,
143
+ yInsetBottom,
144
+ yClamp,
145
+ yRound,
146
+ yAlign,
147
+ yPadding,
148
+ yPaddingInner,
149
+ yPaddingOuter,
150
+ yAxis,
151
+ yTicks,
152
+ yTickSize,
153
+ yTickSpacing,
154
+ yTickPadding,
155
+ yTickFormat,
156
+ yTickRotate,
157
+ yGrid,
158
+ yLine,
159
+ yLabel,
160
+ yLabelAnchor,
161
+ yLabelOffset,
162
+ yFontVariant,
163
+ yAriaLabel,
164
+ yAriaDescription,
165
+ yReverse,
166
+ yZero,
167
+ yBase,
168
+ yExponent,
169
+ yConstant,
170
+ facetMargin,
171
+ facetMarginTop,
172
+ facetMarginBottom,
173
+ facetMarginLeft,
174
+ facetMarginRight,
175
+ facetGrid,
176
+ facetLabel,
177
+ fxDomain,
178
+ fxRange,
179
+ fxNice,
180
+ fxInset,
181
+ fxInsetLeft,
182
+ fxInsetRight,
183
+ fxRound,
184
+ fxAlign,
185
+ fxPadding,
186
+ fxPaddingInner,
187
+ fxPaddingOuter,
188
+ fxAxis,
189
+ fxTicks,
190
+ fxTickSize,
191
+ fxTickSpacing,
192
+ fxTickPadding,
193
+ fxTickFormat,
194
+ fxTickRotate,
195
+ fxGrid,
196
+ fxLine,
197
+ fxLabel,
198
+ fxLabelAnchor,
199
+ fxLabelOffset,
200
+ fxFontVariant,
201
+ fxAriaLabel,
202
+ fxAriaDescription,
203
+ fxReverse,
204
+ fyDomain,
205
+ fyRange,
206
+ fyNice,
207
+ fyInset,
208
+ fyInsetTop,
209
+ fyInsetBottom,
210
+ fyRound,
211
+ fyAlign,
212
+ fyPadding,
213
+ fyPaddingInner,
214
+ fyPaddingOuter,
215
+ fyAxis,
216
+ fyTicks,
217
+ fyTickSize,
218
+ fyTickSpacing,
219
+ fyTickPadding,
220
+ fyTickFormat,
221
+ fyTickRotate,
222
+ fyGrid,
223
+ fyLine,
224
+ fyLabel,
225
+ fyLabelAnchor,
226
+ fyLabelOffset,
227
+ fyFontVariant,
228
+ fyAriaLabel,
229
+ fyAriaDescription,
230
+ fyReverse,
231
+ colorScale,
232
+ colorDomain,
233
+ colorRange,
234
+ colorClamp,
235
+ colorN,
236
+ colorNice,
237
+ colorScheme,
238
+ colorInterpolate,
239
+ colorPivot,
240
+ colorSymmetric,
241
+ colorLabel,
242
+ colorReverse,
243
+ colorZero,
244
+ colorTickFormat,
245
+ colorBase,
246
+ colorExponent,
247
+ colorConstant,
248
+ opacityScale,
249
+ opacityDomain,
250
+ opacityRange,
251
+ opacityClamp,
252
+ opacityNice,
253
+ opacityLabel,
254
+ opacityReverse,
255
+ opacityZero,
256
+ opacityTickFormat,
257
+ opacityBase,
258
+ opacityExponent,
259
+ opacityConstant,
260
+ rScale,
261
+ rDomain,
262
+ rRange,
263
+ rClamp,
264
+ rNice,
265
+ rZero,
266
+ rBase,
267
+ rExponent,
268
+ rConstant,
269
+ lengthScale,
270
+ lengthDomain,
271
+ lengthRange,
272
+ lengthClamp,
273
+ lengthNice,
274
+ lengthZero,
275
+ lengthBase,
276
+ lengthExponent,
277
+ lengthConstant,
278
+ projectionType,
279
+ projectionParallels,
280
+ projectionPrecision,
281
+ projectionRotate,
282
+ projectionDomain,
283
+ projectionInset,
284
+ projectionInsetLeft,
285
+ projectionInsetRight,
286
+ projectionInsetTop,
287
+ projectionInsetBottom,
288
+ projectionClip,
289
+ } from './plot/attributes.js';
290
+
291
+ export {
292
+ from
293
+ } from './plot/data.js';
294
+
295
+ export {
296
+ area, areaX, areaY,
297
+ line, lineX, lineY,
298
+ barX, barY,
299
+ cell, cellX, cellY,
300
+ rect, rectX, rectY,
301
+ dot, dotX, dotY, circle, hexagon,
302
+ text, textX, textY,
303
+ image,
304
+ tickX, tickY,
305
+ ruleX, ruleY,
306
+ density, densityX, densityY, denseLine,
307
+ raster, rasterTile, heatmap,
308
+ contour,
309
+ hexbin, hexgrid,
310
+ regressionY,
311
+ vector, vectorX, vectorY, spike,
312
+ voronoi, voronoiMesh, delaunayLink, delaunayMesh, hull,
313
+ arrow, link,
314
+ frame,
315
+ axisX, axisY, axisFx, axisFy,
316
+ gridX, gridY, gridFx, gridFy,
317
+ geo, sphere, graticule
318
+ } from './plot/marks.js';
319
+
320
+ export {
321
+ highlight,
322
+ intervalX,
323
+ intervalY,
324
+ intervalXY,
325
+ nearestX,
326
+ nearestY,
327
+ toggle,
328
+ toggleX,
329
+ toggleY,
330
+ toggleColor,
331
+ pan,
332
+ panX,
333
+ panY,
334
+ panZoom,
335
+ panZoomX,
336
+ panZoomY
337
+ } from './plot/interactors.js';
338
+
339
+ export {
340
+ colorLegend,
341
+ opacityLegend,
342
+ symbolLegend
343
+ } from './plot/legends.js';
344
+
345
+ export {
346
+ plot
347
+ } from './plot/plot.js';
package/src/connect.js ADDED
@@ -0,0 +1,14 @@
1
+ import { coordinator } from '@uwdata/mosaic-core';
2
+
3
+ /**
4
+ * Context-sensitive connector for coordinator and clients.
5
+ * This method proxies access to Coordinator.connect().
6
+ * If the provided context object has an explicit coordinator, that is used.
7
+ * Otherwise the default coordinator singleton is used.
8
+ */
9
+ export function connect(ctx, ...clients) {
10
+ const coord = ctx?.context?.coordinator ?? coordinator();
11
+ for (const client of clients) {
12
+ coord.connect(client);
13
+ }
14
+ }
package/src/context.js ADDED
@@ -0,0 +1,20 @@
1
+ import { coordinator as _coordinator } from '@uwdata/mosaic-core';
2
+ import { NamedPlots } from './plot/named-plots.js';
3
+ import * as vgplot from './api.js';
4
+
5
+ export function createAPIContext({
6
+ coordinator = _coordinator(),
7
+ namedPlots = new NamedPlots,
8
+ extensions = null,
9
+ ...options
10
+ } = {}) {
11
+ return {
12
+ ...vgplot,
13
+ ...extensions,
14
+ context: {
15
+ coordinator,
16
+ namedPlots,
17
+ ...options
18
+ }
19
+ };
20
+ }