@uwdata/mosaic-plot 0.17.0 → 0.18.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/LICENSE +47 -0
- package/README.md +1 -1
- package/dist/src/index.d.ts +25 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/interactors/Highlight.d.ts +15 -0
- package/dist/src/interactors/Highlight.d.ts.map +1 -0
- package/dist/src/interactors/Interval1D.d.ts +32 -0
- package/dist/src/interactors/Interval1D.d.ts.map +1 -0
- package/dist/src/interactors/Interval2D.d.ts +33 -0
- package/dist/src/interactors/Interval2D.d.ts.map +1 -0
- package/dist/src/interactors/Nearest.d.ts +26 -0
- package/dist/src/interactors/Nearest.d.ts.map +1 -0
- package/dist/src/interactors/PanZoom.d.ts +34 -0
- package/dist/src/interactors/PanZoom.d.ts.map +1 -0
- package/dist/src/interactors/Region.d.ts +36 -0
- package/dist/src/interactors/Region.d.ts.map +1 -0
- package/dist/src/interactors/Toggle.d.ts +22 -0
- package/dist/src/interactors/Toggle.d.ts.map +1 -0
- package/dist/src/interactors/util/brush.d.ts +5 -0
- package/dist/src/interactors/util/brush.d.ts.map +1 -0
- package/dist/src/interactors/util/close-to.d.ts +2 -0
- package/dist/src/interactors/util/close-to.d.ts.map +1 -0
- package/dist/src/interactors/util/get-datum.d.ts +9 -0
- package/dist/src/interactors/util/get-datum.d.ts.map +1 -0
- package/dist/src/interactors/util/get-field.d.ts +6 -0
- package/dist/src/interactors/util/get-field.d.ts.map +1 -0
- package/dist/src/interactors/util/intersect.d.ts +12 -0
- package/dist/src/interactors/util/intersect.d.ts.map +1 -0
- package/dist/src/interactors/util/invert.d.ts +2 -0
- package/dist/src/interactors/util/invert.d.ts.map +1 -0
- package/dist/src/interactors/util/neq.d.ts +3 -0
- package/dist/src/interactors/util/neq.d.ts.map +1 -0
- package/dist/src/interactors/util/parse-path.d.ts +9 -0
- package/dist/src/interactors/util/parse-path.d.ts.map +1 -0
- package/dist/src/interactors/util/patchScreenCTM.d.ts +10 -0
- package/dist/src/interactors/util/patchScreenCTM.d.ts.map +1 -0
- package/dist/src/interactors/util/sanitize-styles.d.ts +2 -0
- package/dist/src/interactors/util/sanitize-styles.d.ts.map +1 -0
- package/dist/src/interactors/util/to-kebab-case.d.ts +2 -0
- package/dist/src/interactors/util/to-kebab-case.d.ts.map +1 -0
- package/dist/src/legend.d.ts +16 -0
- package/dist/src/legend.d.ts.map +1 -0
- package/dist/src/marks/ConnectedMark.d.ts +6 -0
- package/dist/src/marks/ConnectedMark.d.ts.map +1 -0
- package/dist/src/marks/ContourMark.d.ts +15 -0
- package/dist/src/marks/ContourMark.d.ts.map +1 -0
- package/dist/src/marks/DenseLineMark.d.ts +6 -0
- package/dist/src/marks/DenseLineMark.d.ts.map +1 -0
- package/dist/src/marks/Density1DMark.d.ts +34 -0
- package/dist/src/marks/Density1DMark.d.ts.map +1 -0
- package/dist/src/marks/Density2DMark.d.ts +13 -0
- package/dist/src/marks/Density2DMark.d.ts.map +1 -0
- package/dist/src/marks/ErrorBarMark.d.ts +11 -0
- package/dist/src/marks/ErrorBarMark.d.ts.map +1 -0
- package/dist/src/marks/GeoMark.d.ts +6 -0
- package/dist/src/marks/GeoMark.d.ts.map +1 -0
- package/dist/src/marks/Grid2DMark.d.ts +48 -0
- package/dist/src/marks/Grid2DMark.d.ts.map +1 -0
- package/dist/src/marks/HexbinMark.d.ts +8 -0
- package/dist/src/marks/HexbinMark.d.ts.map +1 -0
- package/dist/src/marks/Mark.d.ts +78 -0
- package/dist/src/marks/Mark.d.ts.map +1 -0
- package/dist/src/marks/RasterMark.d.ts +62 -0
- package/dist/src/marks/RasterMark.d.ts.map +1 -0
- package/dist/src/marks/RasterTileMark.d.ts +32 -0
- package/dist/src/marks/RasterTileMark.d.ts.map +1 -0
- package/dist/src/marks/RegressionMark.d.ts +52 -0
- package/dist/src/marks/RegressionMark.d.ts.map +1 -0
- package/dist/src/marks/util/bin-expr.d.ts +9 -0
- package/dist/src/marks/util/bin-expr.d.ts.map +1 -0
- package/dist/src/marks/util/channel-scale.d.ts +2 -0
- package/dist/src/marks/util/channel-scale.d.ts.map +1 -0
- package/dist/src/marks/util/density.d.ts +13 -0
- package/dist/src/marks/util/density.d.ts.map +1 -0
- package/dist/src/marks/util/extent.d.ts +12 -0
- package/dist/src/marks/util/extent.d.ts.map +1 -0
- package/dist/src/marks/util/grid.d.ts +62 -0
- package/dist/src/marks/util/grid.d.ts.map +1 -0
- package/dist/src/marks/util/handle-param.d.ts +8 -0
- package/dist/src/marks/util/handle-param.d.ts.map +1 -0
- package/dist/src/marks/util/is-color.d.ts +2 -0
- package/dist/src/marks/util/is-color.d.ts.map +1 -0
- package/dist/src/marks/util/is-constant-option.d.ts +2 -0
- package/dist/src/marks/util/is-constant-option.d.ts.map +1 -0
- package/dist/src/marks/util/is-symbol.d.ts +2 -0
- package/dist/src/marks/util/is-symbol.d.ts.map +1 -0
- package/dist/src/marks/util/permute.d.ts +3 -0
- package/dist/src/marks/util/permute.d.ts.map +1 -0
- package/dist/src/marks/util/raster.d.ts +7 -0
- package/dist/src/marks/util/raster.d.ts.map +1 -0
- package/dist/src/marks/util/stats.d.ts +44 -0
- package/dist/src/marks/util/stats.d.ts.map +1 -0
- package/dist/src/plot-attributes.d.ts +3 -0
- package/dist/src/plot-attributes.d.ts.map +1 -0
- package/dist/src/plot-renderer.d.ts +3 -0
- package/dist/src/plot-renderer.d.ts.map +1 -0
- package/dist/src/plot.d.ts +70 -0
- package/dist/src/plot.d.ts.map +1 -0
- package/dist/src/symbols.d.ts +4 -0
- package/dist/src/symbols.d.ts.map +1 -0
- package/dist/src/transforms/bin.d.ts +22 -0
- package/dist/src/transforms/bin.d.ts.map +1 -0
- package/package.json +14 -7
- package/src/interactors/Nearest.js +3 -1
- package/src/interactors/PanZoom.js +2 -1
- package/src/interactors/Toggle.js +2 -1
- package/src/marks/Density1DMark.js +2 -0
- package/src/marks/Density2DMark.js +1 -0
- package/src/marks/ErrorBarMark.js +1 -0
- package/src/marks/GeoMark.js +1 -0
- package/src/marks/Grid2DMark.js +1 -0
- package/src/marks/Mark.js +2 -1
- package/src/marks/RasterMark.js +1 -0
- package/src/marks/RasterTileMark.js +1 -0
- package/src/plot.js +3 -3
- package/tsconfig.json +0 -9
- package/vitest.config.ts +0 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function hasExtent(mark: any, channel: any): boolean;
|
|
2
|
+
export function bin(field: any, options?: {}): {
|
|
3
|
+
(mark: any, channel: any): {
|
|
4
|
+
[x: string]: BinTransformNode;
|
|
5
|
+
};
|
|
6
|
+
[Transform]: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare class BinTransformNode extends ExprNode {
|
|
9
|
+
constructor(column: any, mark: any, channel: any, options: any);
|
|
10
|
+
column: any;
|
|
11
|
+
mark: any;
|
|
12
|
+
channel: any;
|
|
13
|
+
options: any;
|
|
14
|
+
get stats(): {
|
|
15
|
+
column: any;
|
|
16
|
+
stats: string[];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
import { Transform } from '../symbols.js';
|
|
20
|
+
import { ExprNode } from '@uwdata/mosaic-sql';
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=bin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../src/transforms/bin.js"],"names":[],"mappings":"AAQA,4DAEC;AAED;;;;;EAeC;AAWD;IACE,gEAMC;IAJC,YAAoB;IACpB,UAAgB;IAChB,aAAsB;IACtB,aAAsB;IAGxB;;;MAEC;CAaF;0BA7DyB,eAAe;yBADO,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uwdata/mosaic-plot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "A Mosaic-powered plotting framework based on Observable Plot.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data",
|
|
@@ -16,20 +16,27 @@
|
|
|
16
16
|
"types": "./dist/src/index.d.ts",
|
|
17
17
|
"default": "./src/index.js"
|
|
18
18
|
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"!dist/tsconfig.tsbuildinfo",
|
|
22
|
+
"src"
|
|
23
|
+
],
|
|
19
24
|
"repository": {
|
|
20
25
|
"type": "git",
|
|
21
26
|
"url": "https://github.com/uwdata/mosaic.git"
|
|
22
27
|
},
|
|
23
28
|
"scripts": {
|
|
24
|
-
"
|
|
29
|
+
"clean": "rimraf dist && mkdir dist",
|
|
30
|
+
"prebuild": "npm run clean",
|
|
25
31
|
"lint": "eslint src test",
|
|
26
|
-
"test": "vitest run
|
|
27
|
-
"prepublishOnly": "npm run test && npm run lint && tsc"
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"prepublishOnly": "npm run test && npm run lint && tsc --build"
|
|
28
34
|
},
|
|
29
35
|
"dependencies": {
|
|
30
36
|
"@observablehq/plot": "^0.6.17",
|
|
31
|
-
"@uwdata/mosaic-core": "^0.
|
|
32
|
-
"@uwdata/mosaic-sql": "^0.
|
|
37
|
+
"@uwdata/mosaic-core": "^0.18.0",
|
|
38
|
+
"@uwdata/mosaic-sql": "^0.18.0",
|
|
33
39
|
"d3": "^7.9.0"
|
|
34
|
-
}
|
|
40
|
+
},
|
|
41
|
+
"gitHead": "dfb9ded0b0307754e3185ca34cc49a1384fe8455"
|
|
35
42
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @import { ClauseSource } from '@uwdata/mosaic-core' */
|
|
1
2
|
import { clausePoint, clausePoints, isSelection } from '@uwdata/mosaic-core';
|
|
2
3
|
import { select, pointer, min } from 'd3';
|
|
3
4
|
import { getField } from './util/get-field.js';
|
|
@@ -28,7 +29,7 @@ export class Nearest {
|
|
|
28
29
|
|
|
29
30
|
clause(value) {
|
|
30
31
|
const { clients, fields } = this;
|
|
31
|
-
const opt = { source: this, clients };
|
|
32
|
+
const opt = { source: /** @type {ClauseSource} */(this), clients };
|
|
32
33
|
// if only one field, use a simpler clause that passes the value
|
|
33
34
|
// this allows a single field selection value to act like a param
|
|
34
35
|
return fields.length > 1
|
|
@@ -37,6 +38,7 @@ export class Nearest {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
init(svg) {
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
40
42
|
const that = this;
|
|
41
43
|
const { mark, channels, selection, maxRadius } = this;
|
|
42
44
|
const { data: { columns } } = mark;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @import { ClauseSource } from '@uwdata/mosaic-core' */
|
|
1
2
|
import { Selection, clauseInterval } from '@uwdata/mosaic-core';
|
|
2
3
|
import { select, zoom, ZoomTransform } from 'd3';
|
|
3
4
|
import { getField } from './util/get-field.js';
|
|
@@ -53,7 +54,7 @@ export class PanZoom {
|
|
|
53
54
|
|
|
54
55
|
clause(value, field, scale) {
|
|
55
56
|
return clauseInterval(field, value, {
|
|
56
|
-
source: this,
|
|
57
|
+
source: /** @type {ClauseSource} */(this),
|
|
57
58
|
clients: this.mark.plot.markSet,
|
|
58
59
|
scale
|
|
59
60
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @import { ClauseSource } from '@uwdata/mosaic-core' */
|
|
1
2
|
import { clausePoints } from '@uwdata/mosaic-core';
|
|
2
3
|
import { getDatum } from './util/get-datum.js';
|
|
3
4
|
import { neq, neqSome } from './util/neq.js';
|
|
@@ -42,7 +43,7 @@ export class Toggle {
|
|
|
42
43
|
clause(value) {
|
|
43
44
|
const { fields, mark } = this;
|
|
44
45
|
return clausePoints(fields, value, {
|
|
45
|
-
source: this,
|
|
46
|
+
source: /** @type {ClauseSource} */(this),
|
|
46
47
|
clients: this.peers ? mark.plot.markSet : new Set().add(mark)
|
|
47
48
|
});
|
|
48
49
|
}
|
|
@@ -68,6 +68,7 @@ export class Density1DMark extends Mark {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
queryResult(data) {
|
|
71
|
+
// @ts-expect-error Correct the data column type
|
|
71
72
|
const c = toDataColumns(data).columns;
|
|
72
73
|
this.grids = grid1d(this.bins, c.index, c.density, c, this.groupby);
|
|
73
74
|
return this.convolve();
|
|
@@ -114,6 +115,7 @@ export class Density1DMark extends Mark {
|
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
plotSpecs() {
|
|
118
|
+
// @ts-expect-error Correct the data column type
|
|
117
119
|
const { type, data: { numRows: length, columns }, channels, dim, stack } = this;
|
|
118
120
|
|
|
119
121
|
// control if Plot's implicit stack transform is applied
|
|
@@ -33,6 +33,7 @@ export class Density2DMark extends Grid2DMark {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
plotSpecs() {
|
|
36
|
+
// @ts-expect-error Correct the data column type
|
|
36
37
|
const { type, channels, densityMap, data: { numRows: length, columns } } = this;
|
|
37
38
|
const options = {};
|
|
38
39
|
for (const c of channels) {
|
|
@@ -38,6 +38,7 @@ export class ErrorBarMark extends Mark {
|
|
|
38
38
|
|
|
39
39
|
// compute confidence interval channels
|
|
40
40
|
const p = Math.SQRT2 * erfinv(ci);
|
|
41
|
+
// @ts-expect-error Correct the data column type
|
|
41
42
|
const { columns: { __avg__: u, __se__: s } } = data;
|
|
42
43
|
const options = {
|
|
43
44
|
[`${dim}1`]: u.map((u, i) => u - p * s[i]),
|
package/src/marks/GeoMark.js
CHANGED
|
@@ -23,6 +23,7 @@ export class GeoMark extends Mark {
|
|
|
23
23
|
// look for an explicit geometry field
|
|
24
24
|
const geom = this.channelField('geometry')?.as;
|
|
25
25
|
if (geom) {
|
|
26
|
+
// @ts-expect-error Correct the data column type
|
|
26
27
|
const { columns } = this.data;
|
|
27
28
|
if (typeof columns[geom][0] === 'string') {
|
|
28
29
|
columns[geom] = columns[geom].map(s => JSON.parse(s));
|
package/src/marks/Grid2DMark.js
CHANGED
|
@@ -158,6 +158,7 @@ export class Grid2DMark extends Mark {
|
|
|
158
158
|
queryResult(data) {
|
|
159
159
|
const [w, h] = this.bins;
|
|
160
160
|
const interp = maybeInterpolate(this.interpolate);
|
|
161
|
+
// @ts-expect-error Correct the data column type
|
|
161
162
|
const { columns } = toDataColumns(data);
|
|
162
163
|
this.grids0 = grid2d(w, h, columns.index, columns, this.aggr, this.groupby, interp);
|
|
163
164
|
return this.convolve();
|
package/src/marks/Mark.js
CHANGED
|
@@ -21,7 +21,7 @@ const fieldEntry = (channel, field) => ({
|
|
|
21
21
|
const valueEntry = (channel, value) => ({ channel, value });
|
|
22
22
|
|
|
23
23
|
// checks if a data source is an explicit array of values
|
|
24
|
-
// as opposed to a database table
|
|
24
|
+
// as opposed to a database table reference
|
|
25
25
|
export const isDataArray = source => Array.isArray(source);
|
|
26
26
|
|
|
27
27
|
export class Mark extends MosaicClient {
|
|
@@ -67,6 +67,7 @@ export class Mark extends MosaicClient {
|
|
|
67
67
|
} else if (isParamLike(entry)) {
|
|
68
68
|
const c = valueEntry(channel, entry.value);
|
|
69
69
|
channels.push(c);
|
|
70
|
+
// @ts-expect-error FIXME
|
|
70
71
|
entry.addEventListener('value', value => {
|
|
71
72
|
// update immediately, the value is simply passed to Plot
|
|
72
73
|
c.value = value;
|
package/src/marks/RasterMark.js
CHANGED
package/src/plot.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { distinct,
|
|
1
|
+
import { distinct, Synchronizer } from '@uwdata/mosaic-core';
|
|
2
2
|
import { plotRenderer } from './plot-renderer.js';
|
|
3
3
|
|
|
4
4
|
const DEFAULT_ATTRIBUTES = {
|
|
@@ -26,8 +26,8 @@ export class Plot {
|
|
|
26
26
|
this.markset = null;
|
|
27
27
|
/** @type {Map<import('@uwdata/mosaic-core').Param, import('./marks/Mark.js').Mark[]>} */
|
|
28
28
|
this.params = new Map;
|
|
29
|
-
/** @type {
|
|
30
|
-
this.synch =
|
|
29
|
+
/** @type {Synchronizer} */
|
|
30
|
+
this.synch = new Synchronizer();
|
|
31
31
|
|
|
32
32
|
/** @type {HTMLElement} */
|
|
33
33
|
this.element = element || document.createElement('div');
|
package/tsconfig.json
DELETED
package/vitest.config.ts
DELETED