@uwdata/vgplot 0.7.1 → 0.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uwdata/vgplot",
3
- "version": "0.7.1",
3
+ "version": "0.9.0",
4
4
  "description": "An API for interactive Mosaic-powered visualizations and dashboards.",
5
5
  "keywords": [
6
6
  "data",
@@ -25,15 +25,15 @@
25
25
  "scripts": {
26
26
  "prebuild": "rimraf dist && mkdir dist",
27
27
  "build": "node ../../esbuild.js vgplot",
28
- "lint": "eslint src test --ext .js",
28
+ "lint": "eslint src test",
29
29
  "test": "mocha 'test/**/*-test.js'",
30
30
  "prepublishOnly": "npm run test && npm run lint && npm run build"
31
31
  },
32
32
  "dependencies": {
33
- "@uwdata/mosaic-core": "^0.7.1",
34
- "@uwdata/mosaic-inputs": "^0.7.1",
35
- "@uwdata/mosaic-plot": "^0.7.1",
36
- "@uwdata/mosaic-sql": "^0.7.0"
33
+ "@uwdata/mosaic-core": "^0.9.0",
34
+ "@uwdata/mosaic-inputs": "^0.9.0",
35
+ "@uwdata/mosaic-plot": "^0.9.0",
36
+ "@uwdata/mosaic-sql": "^0.9.0"
37
37
  },
38
- "gitHead": "7e6f3ea9b3011ea2c9201c1aa16e8e5664621a4c"
38
+ "gitHead": "89bb9b0dfa747aed691eaeba35379525a6764c61"
39
39
  }
package/src/api.js CHANGED
@@ -24,6 +24,7 @@ export {
24
24
  avg,
25
25
  count,
26
26
  corr,
27
+ covariance,
27
28
  covarPop,
28
29
  entropy,
29
30
  first,
@@ -100,7 +101,6 @@ export {
100
101
  grid,
101
102
  label,
102
103
  padding,
103
- round,
104
104
  xScale,
105
105
  xDomain,
106
106
  xRange,
@@ -125,10 +125,12 @@ export {
125
125
  xLine,
126
126
  xLabel,
127
127
  xLabelAnchor,
128
+ xLabelArrow,
128
129
  xLabelOffset,
129
130
  xFontVariant,
130
131
  xAriaLabel,
131
132
  xAriaDescription,
133
+ xPercent,
132
134
  xReverse,
133
135
  xZero,
134
136
  xBase,
@@ -158,10 +160,12 @@ export {
158
160
  yLine,
159
161
  yLabel,
160
162
  yLabelAnchor,
163
+ yLabelArrow,
161
164
  yLabelOffset,
162
165
  yFontVariant,
163
166
  yAriaLabel,
164
167
  yAriaDescription,
168
+ yPercent,
165
169
  yReverse,
166
170
  yZero,
167
171
  yBase,
@@ -176,7 +180,6 @@ export {
176
180
  facetLabel,
177
181
  fxDomain,
178
182
  fxRange,
179
- fxNice,
180
183
  fxInset,
181
184
  fxInsetLeft,
182
185
  fxInsetRight,
@@ -203,7 +206,6 @@ export {
203
206
  fxReverse,
204
207
  fyDomain,
205
208
  fyRange,
206
- fyNice,
207
209
  fyInset,
208
210
  fyInsetTop,
209
211
  fyInsetBottom,
@@ -239,6 +241,7 @@ export {
239
241
  colorPivot,
240
242
  colorSymmetric,
241
243
  colorLabel,
244
+ colorPercent,
242
245
  colorReverse,
243
246
  colorZero,
244
247
  colorTickFormat,
@@ -251,17 +254,22 @@ export {
251
254
  opacityClamp,
252
255
  opacityNice,
253
256
  opacityLabel,
257
+ opacityPercent,
254
258
  opacityReverse,
255
259
  opacityZero,
256
260
  opacityTickFormat,
257
261
  opacityBase,
258
262
  opacityExponent,
259
263
  opacityConstant,
264
+ symbolScale,
265
+ symbolDomain,
266
+ symbolRange,
260
267
  rScale,
261
268
  rDomain,
262
269
  rRange,
263
270
  rClamp,
264
271
  rNice,
272
+ rPercent,
265
273
  rZero,
266
274
  rBase,
267
275
  rExponent,
@@ -271,6 +279,7 @@ export {
271
279
  lengthRange,
272
280
  lengthClamp,
273
281
  lengthNice,
282
+ lengthPercent,
274
283
  lengthZero,
275
284
  lengthBase,
276
285
  lengthExponent,
@@ -299,6 +308,7 @@ export {
299
308
  cell, cellX, cellY,
300
309
  rect, rectX, rectY,
301
310
  dot, dotX, dotY, circle, hexagon,
311
+ errorbarX, errorbarY,
302
312
  text, textX, textY,
303
313
  image,
304
314
  tickX, tickY,
@@ -322,11 +332,13 @@ export {
322
332
  intervalX,
323
333
  intervalY,
324
334
  intervalXY,
335
+ nearest,
325
336
  nearestX,
326
337
  nearestY,
327
338
  toggle,
328
339
  toggleX,
329
340
  toggleY,
341
+ toggleZ,
330
342
  toggleColor,
331
343
  pan,
332
344
  panX,
@@ -6,7 +6,7 @@ export function concat({ direction = 'vertical', wrap = false }, children) {
6
6
  div.style.justifyContent = 'flex-start';
7
7
  div.style.alignItems = 'flex-start';
8
8
  children.forEach(child => div.appendChild(child));
9
- div.value = { element: div };
9
+ Object.assign(div, { value: { element: div } });
10
10
  return div;
11
11
  }
12
12
 
@@ -2,9 +2,7 @@ export function space({ dim = 'width', size = 10 }) {
2
2
  const span = document.createElement('span');
3
3
  span.style.display = 'inline-block';
4
4
  span.style[dim] = Number.isNaN(+size) ? size : `${size}px`;
5
- const obj = { element: span };
6
- span.value = obj;
7
- return span;
5
+ return Object.assign(span, { value: { element: span } });
8
6
  }
9
7
 
10
8
  export function vspace(size) {
@@ -71,7 +71,6 @@ export const inset = attrf('inset');
71
71
  export const grid = attrf('grid');
72
72
  export const label = attrf('label');
73
73
  export const padding = attrf('padding');
74
- export const round = attrf('round');
75
74
 
76
75
  // x scale attributes
77
76
  export const xScale = attrf('xScale');
@@ -98,10 +97,12 @@ export const xGrid = attrf('xGrid');
98
97
  export const xLine = attrf('xLine');
99
98
  export const xLabel = attrf('xLabel');
100
99
  export const xLabelAnchor = attrf('xLabelAnchor');
100
+ export const xLabelArrow = attrf('xLabelArrow');
101
101
  export const xLabelOffset = attrf('xLabelOffset');
102
102
  export const xFontVariant = attrf('xFontVariant');
103
103
  export const xAriaLabel = attrf('xAriaLabel');
104
104
  export const xAriaDescription = attrf('xAriaDescription');
105
+ export const xPercent = attrf('xPercent');
105
106
  export const xReverse = attrf('xReverse');
106
107
  export const xZero = attrf('xZero');
107
108
  export const xBase = attrf('xBase');
@@ -133,10 +134,12 @@ export const yGrid = attrf('yGrid');
133
134
  export const yLine = attrf('yLine');
134
135
  export const yLabel = attrf('yLabel');
135
136
  export const yLabelAnchor = attrf('yLabelAnchor');
137
+ export const yLabelArrow = attrf('yLabelArrow');
136
138
  export const yLabelOffset = attrf('yLabelOffset');
137
139
  export const yFontVariant = attrf('yFontVariant');
138
140
  export const yAriaLabel = attrf('yAriaLabel');
139
141
  export const yAriaDescription = attrf('yAriaDescription');
142
+ export const yPercent = attrf('yPercent');
140
143
  export const yReverse = attrf('yReverse');
141
144
  export const yZero = attrf('yZero');
142
145
  export const yBase = attrf('yBase');
@@ -155,7 +158,6 @@ export const facetLabel = attrf('facetLabel');
155
158
  // fx scale attributes
156
159
  export const fxDomain = attrf('fxDomain');
157
160
  export const fxRange = attrf('fxRange');
158
- export const fxNice = attrf('fxNice');
159
161
  export const fxInset = attrf('fxInset');
160
162
  export const fxInsetLeft = attrf('fxInsetLeft');
161
163
  export const fxInsetRight = attrf('fxInsetRight');
@@ -184,7 +186,6 @@ export const fxReverse = attrf('fxReverse');
184
186
  // fy scale attributes
185
187
  export const fyDomain = attrf('fyDomain');
186
188
  export const fyRange = attrf('fyRange');
187
- export const fyNice = attrf('fyNice');
188
189
  export const fyInset = attrf('fyInset');
189
190
  export const fyInsetTop = attrf('fyInsetTop');
190
191
  export const fyInsetBottom = attrf('fyInsetBottom');
@@ -222,6 +223,7 @@ export const colorInterpolate = attrf('colorInterpolate');
222
223
  export const colorPivot = attrf('colorPivot');
223
224
  export const colorSymmetric = attrf('colorSymmetric');
224
225
  export const colorLabel = attrf('colorLabel');
226
+ export const colorPercent = attrf('colorPercent');
225
227
  export const colorReverse = attrf('colorReverse');
226
228
  export const colorZero = attrf('colorZero');
227
229
  export const colorTickFormat = attrf('colorTickFormat');
@@ -236,6 +238,7 @@ export const opacityRange = attrf('opacityRange');
236
238
  export const opacityClamp = attrf('opacityClamp');
237
239
  export const opacityNice = attrf('opacityNice');
238
240
  export const opacityLabel = attrf('opacityLabel');
241
+ export const opacityPercent = attrf('opacityPercent');
239
242
  export const opacityReverse = attrf('opacityReverse');
240
243
  export const opacityZero = attrf('opacityZero');
241
244
  export const opacityTickFormat = attrf('opacityTickFormat');
@@ -243,12 +246,18 @@ export const opacityBase = attrf('opacityBase');
243
246
  export const opacityExponent = attrf('opacityExponent');
244
247
  export const opacityConstant = attrf('opacityConstant');
245
248
 
249
+ // symbol scale attributes
250
+ export const symbolScale = attrf('symbolScale');
251
+ export const symbolDomain = attrf('symbolDomain');
252
+ export const symbolRange = attrf('symbolRange');
253
+
246
254
  // r scale attributes
247
255
  export const rScale = attrf('rScale');
248
256
  export const rDomain = attrf('rDomain');
249
257
  export const rRange = attrf('rRange');
250
258
  export const rClamp = attrf('rClamp');
251
259
  export const rNice = attrf('rNice');
260
+ export const rPercent = attrf('rPercent');
252
261
  export const rZero = attrf('rZero');
253
262
  export const rBase = attrf('rBase');
254
263
  export const rExponent = attrf('rExponent');
@@ -260,6 +269,7 @@ export const lengthDomain = attrf('lengthDomain');
260
269
  export const lengthRange = attrf('lengthRange');
261
270
  export const lengthClamp = attrf('lengthClamp');
262
271
  export const lengthNice = attrf('lengthNice');
272
+ export const lengthPercent = attrf('lengthPercent');
263
273
  export const lengthZero = attrf('lengthZero');
264
274
  export const lengthBase = attrf('lengthBase');
265
275
  export const lengthExponent = attrf('lengthExponent');
@@ -30,16 +30,24 @@ export function toggleY(options) {
30
30
  return toggle({ ...options, channels: ['y'] });
31
31
  }
32
32
 
33
+ export function toggleZ(options) {
34
+ return toggle({ ...options, channels: ['z'] });
35
+ }
36
+
33
37
  export function toggleColor(options) {
34
38
  return toggle({ ...options, channels: ['color'] });
35
39
  }
36
40
 
41
+ export function nearest({ as, ...rest }) {
42
+ return interactor(Nearest, { ...rest, selection: as, pointer: 'xy' });
43
+ }
44
+
37
45
  export function nearestX({ as, ...rest }) {
38
- return interactor(Nearest, { ...rest, selection: as, channel: 'x' });
46
+ return interactor(Nearest, { ...rest, selection: as, pointer: 'x' });
39
47
  }
40
48
 
41
49
  export function nearestY({ as, ...rest }) {
42
- return interactor(Nearest, { ...rest, selection: as, channel: 'y' });
50
+ return interactor(Nearest, { ...rest, selection: as, pointer: 'y' });
43
51
  }
44
52
 
45
53
  export function intervalX({ as, ...rest }) {
package/src/plot/marks.js CHANGED
@@ -5,12 +5,13 @@ import {
5
5
  Density1DMark,
6
6
  Density2DMark,
7
7
  DenseLineMark,
8
+ ErrorBarMark,
8
9
  GeoMark,
9
10
  HeatmapMark,
10
11
  HexbinMark,
11
12
  RasterMark,
12
13
  RasterTileMark,
13
- RegressionMark
14
+ RegressionMark,
14
15
  } from '@uwdata/mosaic-plot';
15
16
 
16
17
  const decorators = new Set([
@@ -102,6 +103,9 @@ export const hexgrid = (...args) => mark('hexgrid', ...args);
102
103
 
103
104
  export const regressionY = (...args) => implicitType(RegressionMark, ...args);
104
105
 
106
+ export const errorbarX = (...args) => explicitType(ErrorBarMark, 'ruleY', ...args);
107
+ export const errorbarY = (...args) => implicitType(ErrorBarMark, 'ruleX', ...args);
108
+
105
109
  export const voronoi = (...args) => mark('voronoi', ...args);
106
110
  export const voronoiMesh = (...args) => mark('voronoiMesh', ...args);
107
111
  export const delaunayLink = (...args) => mark('delaunayLink', ...args);
@@ -19,6 +19,10 @@ export class NamedPlots extends Map {
19
19
  }
20
20
  return super.set(name, plot);
21
21
  }
22
+ clear() {
23
+ this.waiting?.clear();
24
+ return super.clear();
25
+ }
22
26
  }
23
27
 
24
28
  /**
package/src/plot/plot.js CHANGED
@@ -5,5 +5,6 @@ export function plot(...directives) {
5
5
  const p = new Plot();
6
6
  directives.flat().forEach(dir => dir(p));
7
7
  connect(this, ...p.marks); // this -> optional API context
8
+ p.update(); // request update, needed if no marks are defined
8
9
  return p.element;
9
10
  }